Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fallenstardust
YGOMobile
Commits
ffd9a43b
Commit
ffd9a43b
authored
Nov 15, 2019
by
Unicorn369
Committed by
fallenstardust
Dec 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
cb8715a6
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
256 additions
and
123 deletions
+256
-123
Classes/gframe/deck_con.cpp
Classes/gframe/deck_con.cpp
+39
-32
Classes/gframe/drawing.cpp
Classes/gframe/drawing.cpp
+1
-0
Classes/gframe/duelclient.cpp
Classes/gframe/duelclient.cpp
+74
-26
Classes/gframe/event_handler.cpp
Classes/gframe/event_handler.cpp
+66
-33
Classes/gframe/game.cpp
Classes/gframe/game.cpp
+14
-10
Classes/gframe/menu_handler.cpp
Classes/gframe/menu_handler.cpp
+26
-21
Classes/gframe/sound_manager.cpp
Classes/gframe/sound_manager.cpp
+30
-1
Classes/gframe/sound_manager.h
Classes/gframe/sound_manager.h
+6
-0
No files found.
Classes/gframe/deck_con.cpp
View file @
ffd9a43b
...
...
@@ -223,9 +223,10 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
* }
* }*/
case
irr
:
:
gui
::
EGET_BUTTON_CLICKED
:
{
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
switch
(
id
)
{
case
BUTTON_CLEAR_DECK
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
gMutex
.
lock
();
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
370
,
mainGame
->
textFont
,
dataManager
.
GetSysString
(
1339
));
mainGame
->
PopupElement
(
mainGame
->
wQuery
);
...
...
@@ -234,14 +235,14 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_SORT_DECK
:
{
mainGame
->
soundEffectPlayer
->
doShuffleCardEffect
();
//
mainGame->soundEffectPlayer->doShuffleCardEffect();
std
::
sort
(
deckManager
.
current_deck
.
main
.
begin
(),
deckManager
.
current_deck
.
main
.
end
(),
ClientCard
::
deck_sort_lv
);
std
::
sort
(
deckManager
.
current_deck
.
extra
.
begin
(),
deckManager
.
current_deck
.
extra
.
end
(),
ClientCard
::
deck_sort_lv
);
std
::
sort
(
deckManager
.
current_deck
.
side
.
begin
(),
deckManager
.
current_deck
.
side
.
end
(),
ClientCard
::
deck_sort_lv
);
break
;
}
case
BUTTON_SHUFFLE_DECK
:
{
mainGame
->
soundEffectPlayer
->
doShuffleCardEffect
();
//
mainGame->soundEffectPlayer->doShuffleCardEffect();
std
::
random_shuffle
(
deckManager
.
current_deck
.
main
.
begin
(),
deckManager
.
current_deck
.
main
.
end
());
break
;
}
...
...
@@ -255,7 +256,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
mainGame
->
stACMessage
->
setText
(
dataManager
.
GetSysString
(
1335
));
mainGame
->
PopupElement
(
mainGame
->
wACMessage
,
20
);
is_modified
=
false
;
mainGame
->
soundEffectPlayer
->
doSaveDeck
();
//
mainGame->soundEffectPlayer->doSaveDeck();
}
break
;
}
...
...
@@ -284,7 +285,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
mainGame
->
stACMessage
->
setText
(
dataManager
.
GetSysString
(
1335
));
mainGame
->
PopupElement
(
mainGame
->
wACMessage
,
20
);
is_modified
=
false
;
mainGame
->
soundEffectPlayer
->
doSaveDeck
();
//
mainGame->soundEffectPlayer->doSaveDeck();
}
break
;
}
...
...
@@ -300,7 +301,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
mainGame
->
gMutex
.
unlock
();
prev_operation
=
id
;
prev_sel
=
sel
;
mainGame
->
soundEffectPlayer
->
doDelete
();
//
mainGame->soundEffectPlayer->doDelete();
break
;
}
case
BUTTON_LEAVE_GAME
:
{
...
...
@@ -312,12 +313,12 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
prev_operation
=
id
;
break
;
}
mainGame
->
soundEffectPlayer
->
doLeave
();
//
mainGame->soundEffectPlayer->doLeave();
Terminate
();
break
;
}
case
BUTTON_EFFECT_FILTER
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
PopupElement
(
mainGame
->
wCategories
);
break
;
}
...
...
@@ -328,12 +329,12 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_CLEAR_FILTER
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
ClearSearch
();
break
;
}
case
BUTTON_CATEGORY_OK
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
filter_effect
=
0
;
long
long
filter
=
0x1
;
for
(
int
i
=
0
;
i
<
32
;
++
i
,
filter
<<=
1
)
...
...
@@ -345,7 +346,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_MANAGE_DECK
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
if
(
is_modified
&&
!
readonly
&&
!
mainGame
->
chkIgnoreDeckChanges
->
isChecked
())
{
mainGame
->
gMutex
.
lock
();
mainGame
->
SetStaticText
(
mainGame
->
stQMessage
,
370
*
mainGame
->
xScale
,
mainGame
->
guiFont
,
dataManager
.
GetSysString
(
1356
));
...
...
@@ -358,7 +359,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_NEW_CATEGORY
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
gMutex
.
lock
();
mainGame
->
stDMMessage
->
setText
(
dataManager
.
GetSysString
(
1469
));
mainGame
->
ebDMName
->
setVisible
(
true
);
...
...
@@ -369,7 +370,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_RENAME_CATEGORY
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
if
(
mainGame
->
lstCategories
->
getSelected
()
<
4
)
break
;
mainGame
->
gMutex
.
lock
();
...
...
@@ -382,7 +383,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_DELETE_CATEGORY
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
gMutex
.
lock
();
mainGame
->
stDMMessage
->
setText
(
dataManager
.
GetSysString
(
1470
));
mainGame
->
stDMMessage2
->
setVisible
(
true
);
...
...
@@ -393,7 +394,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_NEW_DECK
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
gMutex
.
lock
();
mainGame
->
stDMMessage
->
setText
(
dataManager
.
GetSysString
(
1471
));
mainGame
->
ebDMName
->
setVisible
(
true
);
...
...
@@ -404,7 +405,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_RENAME_DECK
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
gMutex
.
lock
();
mainGame
->
stDMMessage
->
setText
(
dataManager
.
GetSysString
(
1471
));
mainGame
->
ebDMName
->
setVisible
(
true
);
...
...
@@ -415,7 +416,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_DELETE_DECK_DM
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
gMutex
.
lock
();
mainGame
->
stDMMessage
->
setText
(
dataManager
.
GetSysString
(
1337
));
mainGame
->
stDMMessage2
->
setVisible
(
true
);
...
...
@@ -426,7 +427,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_MOVE_DECK
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
gMutex
.
lock
();
mainGame
->
stDMMessage
->
setText
(
dataManager
.
GetSysString
(
1472
));
mainGame
->
cbDMCategory
->
setVisible
(
true
);
...
...
@@ -444,7 +445,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_COPY_DECK
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
gMutex
.
lock
();
mainGame
->
stDMMessage
->
setText
(
dataManager
.
GetSysString
(
1473
));
mainGame
->
cbDMCategory
->
setVisible
(
true
);
...
...
@@ -462,7 +463,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_DM_OK
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
switch
(
prev_operation
)
{
case
BUTTON_NEW_CATEGORY
:
{
int
catesel
=
0
;
...
...
@@ -492,7 +493,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_RENAME_CATEGORY
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
int
catesel
=
mainGame
->
lstCategories
->
getSelected
();
const
wchar_t
*
oldcatename
=
mainGame
->
lstCategories
->
getListItem
(
catesel
);
const
wchar_t
*
newcatename
=
mainGame
->
ebDMName
->
getText
();
...
...
@@ -523,7 +524,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_DELETE_CATEGORY
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
int
catesel
=
mainGame
->
lstCategories
->
getSelected
();
const
wchar_t
*
catename
=
mainGame
->
lstCategories
->
getListItem
(
catesel
);
if
(
deckManager
.
DeleteCategory
(
catename
))
{
...
...
@@ -542,7 +543,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_NEW_DECK
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
const
wchar_t
*
deckname
=
mainGame
->
ebDMName
->
getText
();
wchar_t
catepath
[
256
];
deckManager
.
GetCategoryPath
(
catepath
,
mainGame
->
cbDBCategory
->
getSelected
(),
mainGame
->
cbDBCategory
->
getText
());
...
...
@@ -573,7 +574,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_RENAME_DECK
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
int
catesel
=
mainGame
->
lstCategories
->
getSelected
();
int
decksel
=
mainGame
->
lstDecks
->
getSelected
();
const
wchar_t
*
catename
=
mainGame
->
lstCategories
->
getListItem
(
catesel
);
...
...
@@ -608,7 +609,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_DELETE_DECK_DM
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
int
decksel
=
mainGame
->
lstDecks
->
getSelected
();
wchar_t
filepath
[
256
];
deckManager
.
GetDeckFile
(
filepath
,
mainGame
->
cbDBCategory
,
mainGame
->
cbDBDecks
);
...
...
@@ -633,7 +634,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_MOVE_DECK
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
int
oldcatesel
=
mainGame
->
lstCategories
->
getSelected
();
int
newcatesel
=
mainGame
->
cbDMCategory
->
getSelected
();
int
decksel
=
mainGame
->
lstDecks
->
getSelected
();
...
...
@@ -674,7 +675,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_COPY_DECK
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
int
oldcatesel
=
mainGame
->
lstCategories
->
getSelected
();
int
newcatesel
=
mainGame
->
cbDMCategory
->
getSelected
();
int
decksel
=
mainGame
->
lstDecks
->
getSelected
();
...
...
@@ -723,7 +724,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_DM_CANCEL
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
HideElement
(
mainGame
->
wDMQuery
);
mainGame
->
stDMMessage2
->
setVisible
(
false
);
mainGame
->
ebDMName
->
setVisible
(
false
);
...
...
@@ -731,14 +732,15 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_CLOSE_DECKMANAGER
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
HideElement
(
mainGame
->
wDeckManage
);
break
;
}
case
BUTTON_SIDE_OK
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
if
(
deckManager
.
current_deck
.
main
.
size
()
!=
pre_mainc
||
deckManager
.
current_deck
.
extra
.
size
()
!=
pre_extrac
||
deckManager
.
current_deck
.
side
.
size
()
!=
pre_sidec
)
{
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
INFO
);
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1410
));
break
;
}
...
...
@@ -766,7 +768,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_YES
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
HideElement
(
mainGame
->
wQuery
);
if
(
!
mainGame
->
is_building
||
mainGame
->
is_siding
)
break
;
...
...
@@ -810,7 +812,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_NO
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
HideElement
(
mainGame
->
wQuery
);
if
(
prev_operation
==
COMBOBOX_DBCATEGORY
)
{
mainGame
->
cbDBCategory
->
setSelected
(
prev_category
);
...
...
@@ -1125,6 +1127,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
is_starting_dragging
=
false
;
if
(
!
is_draging
)
break
;
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
CARD_DROP
);
bool
pushed
=
false
;
if
(
hovered_pos
==
1
)
pushed
=
push_main
(
draging_pointer
,
hovered_seq
);
...
...
@@ -1154,6 +1157,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
auto
pointer
=
dataManager
.
GetCodePointer
(
hovered_code
);
if
(
pointer
==
dataManager
.
_datas
.
end
())
break
;
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
CARD_DROP
);
if
(
hovered_pos
==
1
)
{
if
(
push_side
(
pointer
))
pop_main
(
hovered_seq
);
...
...
@@ -1171,6 +1175,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
if
(
!
is_draging
)
{
if
(
hovered_pos
==
0
||
hovered_seq
==
-
1
)
break
;
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
CARD_PICK
);
if
(
hovered_pos
==
1
)
{
pop_main
(
hovered_seq
);
}
else
if
(
hovered_pos
==
2
)
{
...
...
@@ -1213,6 +1218,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
auto
pointer
=
dataManager
.
GetCodePointer
(
hovered_code
);
if
(
!
check_limit
(
pointer
))
break
;
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
CARD_PICK
);
if
(
hovered_pos
==
1
)
{
if
(
!
push_main
(
pointer
))
push_side
(
pointer
);
...
...
@@ -1231,6 +1237,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
case
irr
:
:
EMIE_MOUSE_MOVED
:
{
if
(
is_starting_dragging
)
{
is_draging
=
true
;
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
CARD_PICK
);
if
(
hovered_pos
==
1
)
pop_main
(
hovered_seq
);
else
if
(
hovered_pos
==
2
)
...
...
Classes/gframe/drawing.cpp
View file @
ffd9a43b
...
...
@@ -1135,6 +1135,7 @@ void Game::HideElement(irr::gui::IGUIElement * win, bool set_action) {
fadingList
.
push_back
(
fu
);
}
void
Game
::
PopupElement
(
irr
::
gui
::
IGUIElement
*
element
,
int
hideframe
)
{
mainGame
->
soundManager
->
PlayDialogSound
(
element
);
element
->
getParent
()
->
bringToFront
(
element
);
if
(
!
is_building
)
dField
.
panel
=
element
;
...
...
Classes/gframe/duelclient.cpp
View file @
ffd9a43b
...
...
@@ -84,6 +84,7 @@ void DuelClient::ConnectTimeout(evutil_socket_t fd, short events, void* arg) {
mainGame
->
ShowElement
(
mainGame
->
wSinglePlay
);
else
if
(
!
bot_mode
&&
!
mainGame
->
wLanWindow
->
isVisible
())
mainGame
->
ShowElement
(
mainGame
->
wLanWindow
);
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
INFO
);
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1400
));
mainGame
->
gMutex
.
unlock
();
}
...
...
@@ -174,6 +175,7 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
mainGame
->
ShowElement
(
mainGame
->
wSinglePlay
);
else
if
(
!
bot_mode
&&
!
mainGame
->
wLanWindow
->
isVisible
())
mainGame
->
ShowElement
(
mainGame
->
wLanWindow
);
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
INFO
);
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1400
));
mainGame
->
gMutex
.
unlock
();
}
else
if
(
connect_state
==
0x7
)
{
...
...
@@ -190,12 +192,14 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
else
mainGame
->
ShowElement
(
mainGame
->
wLanWindow
);
mainGame
->
wChat
->
setVisible
(
false
);
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
INFO
);
if
(
events
&
BEV_EVENT_EOF
)
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1401
));
else
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1402
));
mainGame
->
gMutex
.
unlock
();
}
else
{
mainGame
->
gMutex
.
lock
();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
INFO
);
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1502
));
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
...
...
@@ -250,6 +254,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
btnStartBot
->
setEnabled
(
true
);
mainGame
->
btnBotCancel
->
setEnabled
(
true
);
mainGame
->
gMutex
.
lock
();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
INFO
);
if
(
pkt
->
code
==
0
)
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1403
));
else
if
(
pkt
->
code
==
1
)
...
...
@@ -307,6 +312,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
break
;
}
}
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
INFO
);
mainGame
->
env
->
addMessageBox
(
L""
,
msgbuf
);
mainGame
->
cbCategorySelect
->
setEnabled
(
true
);
mainGame
->
cbDeckSelect
->
setEnabled
(
true
);
...
...
@@ -315,6 +321,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
}
case
ERRMSG_SIDEERROR
:
{
mainGame
->
gMutex
.
lock
();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
INFO
);
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1408
));
mainGame
->
gMutex
.
unlock
();
break
;
...
...
@@ -328,6 +335,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
gMutex
.
lock
();
wchar_t
msgbuf
[
256
];
myswprintf
(
msgbuf
,
dataManager
.
GetSysString
(
1411
),
pkt
->
code
>>
12
,
(
pkt
->
code
>>
4
)
&
0xff
,
pkt
->
code
&
0xf
);
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
INFO
);
mainGame
->
env
->
addMessageBox
(
L""
,
msgbuf
);
mainGame
->
gMutex
.
unlock
();
event_base_loopbreak
(
client_base
);
...
...
@@ -405,7 +413,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
break
;
}
case
STOC_JOIN_GAME
:
{
mainGame
->
soundEffectPlayer
->
doPlayerEnterEffect
();
//
mainGame->soundEffectPlayer->doPlayerEnterEffect();
STOC_JoinGame
*
pkt
=
(
STOC_JoinGame
*
)
pdata
;
std
::
wstring
str
;
wchar_t
msgbuf
[
256
];
...
...
@@ -564,7 +572,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
break
;
}
case
STOC_DUEL_START
:
{
mainGame
->
soundEffectPlayer
->
doStartGame
();
//
mainGame->soundEffectPlayer->doStartGame();
mainGame
->
HideElement
(
mainGame
->
wHostPrepare
);
mainGame
->
WaitFrameSignal
(
11
);
mainGame
->
gMutex
.
lock
();
...
...
@@ -773,7 +781,8 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
break
;
}
case
STOC_HS_PLAYER_ENTER
:
{
mainGame
->
soundEffectPlayer
->
doPlayerEnterEffect
();
//mainGame->soundEffectPlayer->doPlayerEnterEffect();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
PLAYER_ENTER
);
STOC_HS_PlayerEnter
*
pkt
=
(
STOC_HS_PlayerEnter
*
)
pdata
;
if
(
pkt
->
pos
>
3
)
break
;
...
...
@@ -807,7 +816,8 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
break
;
mainGame
->
gMutex
.
lock
();
if
(
state
<
8
)
{
mainGame
->
soundEffectPlayer
->
doPlayerEnterEffect
();
//mainGame->soundEffectPlayer->doPlayerEnterEffect();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
PLAYER_ENTER
);
wchar_t
*
prename
=
(
wchar_t
*
)
mainGame
->
stHostPrepDuelist
[
pos
]
->
getText
();
mainGame
->
stHostPrepDuelist
[
state
]
->
setText
(
prename
);
mainGame
->
stHostPrepDuelist
[
pos
]
->
setText
(
L""
);
...
...
@@ -833,7 +843,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame
->
btnHostPrepNotReady
->
setVisible
(
false
);
}
}
else
if
(
state
==
PLAYERCHANGE_LEAVE
)
{
mainGame
->
soundEffectPlayer
->
doPlayerExit
();
//
mainGame->soundEffectPlayer->doPlayerExit();
mainGame
->
stHostPrepDuelist
[
pos
]
->
setText
(
L""
);
mainGame
->
chkHostPrepReady
[
pos
]
->
setChecked
(
false
);
}
else
if
(
state
==
PLAYERCHANGE_OBSERVE
)
{
...
...
@@ -1942,6 +1952,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
return
true
;
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
REVEAL
);
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
207
),
count
);
mainGame
->
AddLog
(
textBuffer
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
...
...
@@ -1979,6 +1990,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
return
true
;
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
REVEAL
);
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
207
),
count
);
mainGame
->
AddLog
(
textBuffer
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
...
...
@@ -2011,6 +2023,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pbuf
+=
count
*
7
;
return
true
;
}
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
REVEAL
);
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
208
),
count
);
mainGame
->
AddLog
(
textBuffer
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
...
...
@@ -2100,7 +2113,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_SHUFFLE_DECK
:
{
mainGame
->
soundEffectPlayer
->
doShuffleCardEffect
();
//
mainGame->soundEffectPlayer->doShuffleCardEffect();
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
if
(
mainGame
->
dField
.
deck
[
player
].
size
()
<
2
)
return
true
;
...
...
@@ -2118,6 +2131,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
dField
.
deck
[
player
][
i
]
->
is_reversed
=
false
;
}
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
SHUFFLE
);
for
(
int
i
=
0
;
i
<
5
;
++
i
)
{
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
);
...
...
@@ -2143,7 +2157,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int
count
=
BufferIO
::
ReadInt8
(
pbuf
);
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
if
(
count
>
1
)
mainGame
->
soundEffectPlayer
->
doShuffleCardEffect
();
//mainGame->soundEffectPlayer->doShuffleCardEffect();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
SHUFFLE
);
mainGame
->
WaitFrameSignal
(
5
);
if
(
player
==
1
&&
!
mainGame
->
dInfo
.
isReplay
&&
!
mainGame
->
dInfo
.
isSingleMode
)
{
bool
flip
=
false
;
...
...
@@ -2188,7 +2203,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
if
(
count
>
1
)
mainGame
->
soundEffectPlayer
->
doShuffleCardEffect
();
//mainGame->soundEffectPlayer->doShuffleCardEffect();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
SHUFFLE
);
for
(
int
i
=
0
;
i
<
5
;
++
i
)
{
for
(
auto
cit
=
mainGame
->
dField
.
extra
[
player
].
begin
();
cit
!=
mainGame
->
dField
.
extra
[
player
].
end
();
++
cit
)
{
if
(
!
((
*
cit
)
->
position
&
POS_FACEUP
))
{
...
...
@@ -2323,6 +2339,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
}
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
SHUFFLE
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
mainGame
->
dField
.
MoveCard
(
mc
[
i
],
10
);
for
(
auto
cit
=
mc
[
i
]
->
overlayed
.
begin
();
cit
!=
mc
[
i
]
->
overlayed
.
end
();
++
cit
)
...
...
@@ -2333,7 +2350,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_NEW_TURN
:
{
mainGame
->
soundEffectPlayer
->
doNewTurnEffect
();
//
mainGame->soundEffectPlayer->doNewTurnEffect();
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
mainGame
->
dInfo
.
turn
++
;
if
(
!
mainGame
->
dInfo
.
isTag
&&
!
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
player_type
<
7
)
{
...
...
@@ -2362,6 +2379,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
dInfo
.
tag_player
[
1
]
=
!
mainGame
->
dInfo
.
tag_player
[
1
];
}
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
NEXT_TURN
);
mainGame
->
showcardcode
=
10
;
mainGame
->
showcarddif
=
30
;
mainGame
->
showcardp
=
0
;
...
...
@@ -2372,7 +2390,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_NEW_PHASE
:
{
mainGame
->
soundEffectPlayer
->
doNewPhaseEffect
();
//
mainGame->soundEffectPlayer->doNewPhaseEffect();
unsigned
short
phase
=
BufferIO
::
ReadInt16
(
pbuf
);
mainGame
->
btnPhaseStatus
->
setVisible
(
false
);
mainGame
->
btnBP
->
setVisible
(
false
);
...
...
@@ -2411,6 +2429,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
btnPhaseStatus
->
setPressed
(
true
);
mainGame
->
btnPhaseStatus
->
setVisible
(
true
);
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
PHASE
);
mainGame
->
showcard
=
101
;
mainGame
->
WaitFrameSignal
(
40
);
mainGame
->
showcard
=
0
;
...
...
@@ -2429,7 +2448,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int
cp
=
BufferIO
::
ReadInt8
(
pbuf
);
int
reason
=
BufferIO
::
ReadInt32
(
pbuf
);
if
(
!
mainGame
->
dInfo
.
isReplaySkiping
&&
reason
&
REASON_DESTROY
&&
pl
!=
cl
)
{
mainGame
->
soundEffectPlayer
->
doDestroyEffect
();
if
(
cl
&
LOCATION_REMOVED
&&
pl
!=
cl
)
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BANISHED
);
else
if
(
reason
&
REASON_DESTROY
&&
pl
!=
cl
)
//mainGame->soundEffectPlayer->doDestroyEffect();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
DESTROYED
);
}
if
(
pl
==
0
)
{
ClientCard
*
pcard
=
new
ClientCard
();
...
...
@@ -2646,7 +2669,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_SET
:
{
mainGame
->
soundEffectPlayer
->
doSetCardEffect
();
//mainGame->soundEffectPlayer->doSetCardEffect();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
SET
);
/*int code = */
BufferIO
::
ReadInt32
(
pbuf
);
/*int cc = mainGame->LocalPlayer*/
(
BufferIO
::
ReadInt8
(
pbuf
));
/*int cl = */
BufferIO
::
ReadInt8
(
pbuf
);
...
...
@@ -2699,12 +2723,14 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_SUMMONING
:
{
mainGame
->
soundEffectPlayer
->
doSummonEffect
();
//
mainGame->soundEffectPlayer->doSummonEffect();
unsigned
int
code
=
(
unsigned
int
)
BufferIO
::
ReadInt32
(
pbuf
);
/*int cc = */
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
/*int cl = */
BufferIO
::
ReadInt8
(
pbuf
);
/*int cs = */
BufferIO
::
ReadInt8
(
pbuf
);
/*int cp = */
BufferIO
::
ReadInt8
(
pbuf
);
if
(
!
mainGame
->
soundManager
->
PlayChant
(
code
))
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
SUMMON
);
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
myswprintf
(
event_string
,
dataManager
.
GetSysString
(
1603
),
dataManager
.
GetName
(
code
));
mainGame
->
showcardcode
=
code
;
...
...
@@ -2722,13 +2748,19 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_SPSUMMONING
:
{
mainGame
->
soundEffectPlayer
->
doSpecialSummonEffect
();
//
mainGame->soundEffectPlayer->doSpecialSummonEffect();
unsigned
int
code
=
(
unsigned
int
)
BufferIO
::
ReadInt32
(
pbuf
);
/*int cc = */
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
/*int cl = */
BufferIO
::
ReadInt8
(
pbuf
);
/*int cs = */
BufferIO
::
ReadInt8
(
pbuf
);
/*int cp = */
BufferIO
::
ReadInt8
(
pbuf
);
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
CardData
cd
;
if
(
dataManager
.
GetData
(
code
,
&
cd
)
&&
(
cd
.
type
&
TYPE_TOKEN
))
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
TOKEN
);
else
if
(
!
mainGame
->
soundManager
->
PlayChant
(
code
))
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
SPECIAL_SUMMON
);
myswprintf
(
event_string
,
dataManager
.
GetSysString
(
1605
),
dataManager
.
GetName
(
code
));
mainGame
->
showcardcode
=
code
;
mainGame
->
showcarddif
=
1
;
...
...
@@ -2744,7 +2776,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_FLIPSUMMONING
:
{
mainGame
->
soundEffectPlayer
->
doFlipCardEffect
();
//
mainGame->soundEffectPlayer->doFlipCardEffect();
unsigned
int
code
=
(
unsigned
int
)
BufferIO
::
ReadInt32
(
pbuf
);
int
cc
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
int
cl
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
@@ -2754,6 +2786,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pcard
->
SetCode
(
code
);
pcard
->
position
=
cp
;
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
if
(
!
mainGame
->
soundManager
->
PlayChant
(
code
))
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
FLIP
);
myswprintf
(
event_string
,
dataManager
.
GetSysString
(
1607
),
dataManager
.
GetName
(
code
));
mainGame
->
dField
.
MoveCard
(
pcard
,
10
);
mainGame
->
WaitFrameSignal
(
11
);
...
...
@@ -2772,7 +2806,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_CHAINING
:
{
mainGame
->
soundEffectPlayer
->
doActivateEffect
();
//mainGame->soundEffectPlayer->doActivateEffect();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
ACTIVATE
);
unsigned
int
code
=
(
unsigned
int
)
BufferIO
::
ReadInt32
(
pbuf
);
int
pcc
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
int
pcl
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
@@ -2896,6 +2931,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pbuf
+=
count
*
4
;
return
true
;
}
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
DICE
);
ClientCard
*
pcards
[
10
];
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
int
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
...
...
@@ -2914,6 +2950,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_BECOME_TARGET
:
{
//mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::TARGET);
int
count
=
BufferIO
::
ReadInt8
(
pbuf
);
if
(
mainGame
->
dInfo
.
isReplay
&&
mainGame
->
dInfo
.
isReplaySkiping
)
{
pbuf
+=
count
*
4
;
...
...
@@ -2969,7 +3006,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
}
else
{
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
mainGame
->
soundEffectPlayer
->
doDrawCardEffect
();
//mainGame->soundEffectPlayer->doDrawCardEffect();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
DRAW
);
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
);
...
...
@@ -2986,7 +3024,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_DAMAGE
:
{
mainGame
->
soundEffectPlayer
->
doDamageEffect
();
//mainGame->soundEffectPlayer->doDamageEffect();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
DAMAGE
);
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
int
val
=
BufferIO
::
ReadInt32
(
pbuf
);
int
final
=
mainGame
->
dInfo
.
lp
[
player
]
-
val
;
...
...
@@ -3017,7 +3056,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_RECOVER
:
{
mainGame
->
soundEffectPlayer
->
doGainLpEffect
();
//mainGame->soundEffectPlayer->doGainLpEffect();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
RECOVER
);
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
int
val
=
BufferIO
::
ReadInt32
(
pbuf
);
int
final
=
mainGame
->
dInfo
.
lp
[
player
]
+
val
;
...
...
@@ -3046,7 +3086,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_EQUIP
:
{
mainGame
->
soundEffectPlayer
->
doEquipEffect
();
//
mainGame->soundEffectPlayer->doEquipEffect();
int
c1
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
int
l1
=
BufferIO
::
ReadInt8
(
pbuf
);
int
s1
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
@@ -3063,6 +3103,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pc1
->
equipTarget
=
pc2
;
pc2
->
equipped
.
insert
(
pc1
);
}
else
{
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
EQUIP
);
mainGame
->
gMutex
.
lock
();
if
(
pc1
->
equipTarget
)
{
pc1
->
is_showequip
=
false
;
...
...
@@ -3171,7 +3212,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
break
;
}
case
MSG_PAY_LPCOST
:
{
mainGame
->
soundEffectPlayer
->
doDamageEffect
();
//mainGame->soundEffectPlayer->doDamageEffect();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
DAMAGE
);
int
player
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
int
cost
=
BufferIO
::
ReadInt32
(
pbuf
);
int
final
=
mainGame
->
dInfo
.
lp
[
player
]
-
cost
;
...
...
@@ -3198,7 +3240,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_ADD_COUNTER
:
{
mainGame
->
soundEffectPlayer
->
doAddCounterEffect
();
//mainGame->soundEffectPlayer->doAddCounterEffect();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
COUNTER_ADD
);
int
type
=
BufferIO
::
ReadInt16
(
pbuf
);
int
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
int
l
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
@@ -3221,7 +3264,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_REMOVE_COUNTER
:
{
mainGame
->
soundEffectPlayer
->
doRemoveCounterEffect
();
//mainGame->soundEffectPlayer->doRemoveCounterEffect();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
COUNTER_REMOVE
);
int
type
=
BufferIO
::
ReadInt16
(
pbuf
);
int
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
int
l
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
@@ -3244,7 +3288,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_ATTACK
:
{
mainGame
->
soundEffectPlayer
->
doAttackEffect
();
//
mainGame->soundEffectPlayer->doAttackEffect();
int
ca
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
int
la
=
BufferIO
::
ReadInt8
(
pbuf
);
int
sa
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
@@ -3258,6 +3302,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
float
sy
;
if
(
ld
!=
0
)
{
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
ATTACK
);
mainGame
->
dField
.
attack_target
=
mainGame
->
dField
.
GetCard
(
cd
,
ld
,
sd
);
myswprintf
(
event_string
,
dataManager
.
GetSysString
(
1619
),
dataManager
.
GetName
(
mainGame
->
dField
.
attacker
->
code
),
dataManager
.
GetName
(
mainGame
->
dField
.
attack_target
->
code
));
...
...
@@ -3272,6 +3317,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
else
mainGame
->
atk_r
=
vector3df
(
0
,
0
,
3.1415926
-
atan
((
xd
-
xa
)
/
(
yd
-
ya
)));
}
else
{
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
DIRECT_ATTACK
);
myswprintf
(
event_string
,
dataManager
.
GetSysString
(
1620
),
dataManager
.
GetName
(
mainGame
->
dField
.
attacker
->
code
));
float
xa
=
mainGame
->
dField
.
attacker
->
curPos
.
X
;
float
ya
=
mainGame
->
dField
.
attacker
->
curPos
.
Y
;
...
...
@@ -3352,7 +3398,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_TOSS_COIN
:
{
mainGame
->
soundEffectPlayer
->
doCoinFlipEffect
();
//mainGame->soundEffectPlayer->doCoinFlipEffect();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
COIN
);
/*int player = */
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
int
count
=
BufferIO
::
ReadInt8
(
pbuf
);
wchar_t
*
pwbuf
=
textBuffer
;
...
...
@@ -3375,7 +3422,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return
true
;
}
case
MSG_TOSS_DICE
:
{
mainGame
->
soundEffectPlayer
->
doDiceRollEffect
();
//mainGame->soundEffectPlayer->doDiceRollEffect();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
DICE
);
/*int player = */
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
int
count
=
BufferIO
::
ReadInt8
(
pbuf
);
wchar_t
*
pwbuf
=
textBuffer
;
...
...
Classes/gframe/event_handler.cpp
View file @
ffd9a43b
...
...
@@ -50,7 +50,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
}
case
BUTTON_FIRST
:
case
BUTTON_SECOND
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//mainGame->soundEffectPlayer->doPressButton();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
mainGame
->
HideElement
(
mainGame
->
wFTSelect
);
CTOS_TPResult
cstr
;
cstr
.
res
=
BUTTON_SECOND
-
id
;
...
...
@@ -58,7 +59,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_REPLAY_START
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//mainGame->soundEffectPlayer->doPressButton();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
if
(
!
mainGame
->
dInfo
.
isReplay
)
break
;
mainGame
->
btnReplayStart
->
setVisible
(
false
);
...
...
@@ -69,7 +71,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_REPLAY_PAUSE
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//mainGame->soundEffectPlayer->doPressButton();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
if
(
!
mainGame
->
dInfo
.
isReplay
)
break
;
mainGame
->
btnReplayStart
->
setVisible
(
true
);
...
...
@@ -80,21 +83,24 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_REPLAY_STEP
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//mainGame->soundEffectPlayer->doPressButton();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
if
(
!
mainGame
->
dInfo
.
isReplay
)
break
;
ReplayMode
::
Pause
(
false
,
true
);
break
;
}
case
BUTTON_REPLAY_EXIT
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//mainGame->soundEffectPlayer->doPressButton();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
if
(
!
mainGame
->
dInfo
.
isReplay
)
break
;
ReplayMode
::
StopReplay
();
break
;
}
case
BUTTON_REPLAY_SWAP
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//mainGame->soundEffectPlayer->doPressButton();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
if
(
mainGame
->
dInfo
.
isReplay
)
ReplayMode
::
SwapField
();
else
if
(
mainGame
->
dInfo
.
player_type
==
7
)
...
...
@@ -102,14 +108,16 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_REPLAY_UNDO
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//mainGame->soundEffectPlayer->doPressButton();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
if
(
!
mainGame
->
dInfo
.
isReplay
)
break
;
ReplayMode
::
Undo
();
break
;
}
case
BUTTON_REPLAY_SAVE
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//mainGame->soundEffectPlayer->doPressButton();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
if
(
mainGame
->
ebRSName
->
getText
()[
0
]
==
0
)
break
;
mainGame
->
actionParam
=
1
;
...
...
@@ -118,14 +126,16 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_REPLAY_CANCEL
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//mainGame->soundEffectPlayer->doPressButton();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
mainGame
->
actionParam
=
0
;
mainGame
->
HideElement
(
mainGame
->
wReplaySave
);
mainGame
->
replaySignal
.
Set
();
break
;
}
case
BUTTON_LEAVE_GAME
:
{
mainGame
->
soundEffectPlayer
->
doPlayerExit
();
//mainGame->soundEffectPlayer->doPlayerExit();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
EQUIP
);
if
(
mainGame
->
dInfo
.
isSingleMode
)
{
mainGame
->
singleSignal
.
SetNoWait
(
true
);
SingleMode
::
StopPlay
(
false
);
...
...
@@ -160,18 +170,21 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_SURRENDER_YES
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//mainGame->soundEffectPlayer->doPressButton();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
DuelClient
::
SendPacketToServer
(
CTOS_SURRENDER
);
mainGame
->
HideElement
(
mainGame
->
wSurrender
);
break
;
}
case
BUTTON_SURRENDER_NO
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//mainGame->soundEffectPlayer->doPressButton();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
mainGame
->
HideElement
(
mainGame
->
wSurrender
);
break
;
}
case
BUTTON_CHAIN_IGNORE
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//mainGame->soundEffectPlayer->doPressButton();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
mainGame
->
ignore_chain
=
mainGame
->
btnChainIgnore
->
isPressed
();
mainGame
->
always_chain
=
false
;
mainGame
->
chain_when_avail
=
false
;
...
...
@@ -179,7 +192,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_CHAIN_ALWAYS
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//mainGame->soundEffectPlayer->doPressButton();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
mainGame
->
always_chain
=
mainGame
->
btnChainAlways
->
isPressed
();
mainGame
->
ignore_chain
=
false
;
mainGame
->
chain_when_avail
=
false
;
...
...
@@ -187,7 +201,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_CHAIN_WHENAVAIL
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//mainGame->soundEffectPlayer->doPressButton();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
mainGame
->
chain_when_avail
=
mainGame
->
btnChainWhenAvail
->
isPressed
();
mainGame
->
always_chain
=
false
;
mainGame
->
ignore_chain
=
false
;
...
...
@@ -195,18 +210,21 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_CANCEL_OR_FINISH
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//mainGame->soundEffectPlayer->doPressButton();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
CancelOrFinish
();
break
;
}
case
BUTTON_MSG_OK
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//mainGame->soundEffectPlayer->doPressButton();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
mainGame
->
HideElement
(
mainGame
->
wMessage
);
mainGame
->
actionSignal
.
Set
();
break
;
}
case
BUTTON_YES
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//mainGame->soundEffectPlayer->doPressButton();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
switch
(
mainGame
->
dInfo
.
curMsg
)
{
case
MSG_SELECT_YESNO
:
case
MSG_SELECT_EFFECTYN
:
{
...
...
@@ -240,7 +258,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_NO
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//mainGame->soundEffectPlayer->doPressButton();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
switch
(
mainGame
->
dInfo
.
curMsg
)
{
case
MSG_SELECT_YESNO
:
case
MSG_SELECT_EFFECTYN
:
{
...
...
@@ -273,31 +292,36 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_POS_AU
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//mainGame->soundEffectPlayer->doPressButton();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
DuelClient
::
SetResponseI
(
POS_FACEUP_ATTACK
);
mainGame
->
HideElement
(
mainGame
->
wPosSelect
,
true
);
break
;
}
case
BUTTON_POS_AD
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//mainGame->soundEffectPlayer->doPressButton();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
DuelClient
::
SetResponseI
(
POS_FACEDOWN_ATTACK
);
mainGame
->
HideElement
(
mainGame
->
wPosSelect
,
true
);
break
;
}
case
BUTTON_POS_DU
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//mainGame->soundEffectPlayer->doPressButton();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
DuelClient
::
SetResponseI
(
POS_FACEUP_DEFENSE
);
mainGame
->
HideElement
(
mainGame
->
wPosSelect
,
true
);
break
;
}
case
BUTTON_POS_DD
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//mainGame->soundEffectPlayer->doPressButton();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
DuelClient
::
SetResponseI
(
POS_FACEDOWN_DEFENSE
);
mainGame
->
HideElement
(
mainGame
->
wPosSelect
,
true
);
break
;
}
case
BUTTON_OPTION_PREV
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//mainGame->soundEffectPlayer->doPressButton();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
selected_option
--
;
mainGame
->
btnOptionn
->
setVisible
(
true
);
if
(
selected_option
==
0
)
...
...
@@ -306,7 +330,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_OPTION_NEXT
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//mainGame->soundEffectPlayer->doPressButton();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
selected_option
++
;
mainGame
->
btnOptionp
->
setVisible
(
true
);
if
(
selected_option
==
select_options
.
size
()
-
1
)
...
...
@@ -319,25 +344,29 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case
BUTTON_OPTION_2
:
case
BUTTON_OPTION_3
:
case
BUTTON_OPTION_4
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//mainGame->soundEffectPlayer->doPressButton();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
int
step
=
mainGame
->
scrOption
->
isVisible
()
?
mainGame
->
scrOption
->
getPos
()
:
0
;
selected_option
=
id
-
BUTTON_OPTION_0
+
step
;
SetResponseSelectedOption
();
break
;
}
case
BUTTON_OPTION_OK
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//mainGame->soundEffectPlayer->doPressButton();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
SetResponseSelectedOption
();
break
;
}
case
BUTTON_ANNUMBER_OK
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//mainGame->soundEffectPlayer->doPressButton();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
DuelClient
::
SetResponseI
(
mainGame
->
cbANNumber
->
getSelected
());
mainGame
->
HideElement
(
mainGame
->
wANNumber
,
true
);
break
;
}
case
BUTTON_ANCARD_OK
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//mainGame->soundEffectPlayer->doPressButton();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
int
sel
=
mainGame
->
lstANCard
->
getSelected
();
if
(
sel
==
-
1
)
break
;
...
...
@@ -346,7 +375,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_CMD_SHUFFLE
:
{
mainGame
->
soundEffectPlayer
->
doShuffleCardEffect
();
//mainGame->soundEffectPlayer->doShuffleCardEffect();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
SHUFFLE
);
mainGame
->
btnShuffle
->
setVisible
(
false
);
DuelClient
::
SetResponseI
(
8
);
DuelClient
::
SendResponse
();
...
...
@@ -544,7 +574,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_CMD_SHOWLIST
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//mainGame->soundEffectPlayer->doPressButton();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
mainGame
->
wCmdMenu
->
setVisible
(
false
);
selectable_cards
.
clear
();
wchar_t
formatBuffer
[
2048
];
...
...
@@ -772,7 +803,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_CARD_SEL_OK
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//mainGame->soundEffectPlayer->doPressButton();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
mainGame
->
stCardListTip
->
setVisible
(
false
);
if
(
mainGame
->
dInfo
.
isReplay
)
{
mainGame
->
HideElement
(
mainGame
->
wCardSelect
);
...
...
@@ -802,7 +834,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_CARD_DISP_OK
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//mainGame->soundEffectPlayer->doPressButton();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
mainGame
->
HideElement
(
mainGame
->
wCardDisplay
);
break
;
}
...
...
Classes/gframe/game.cpp
View file @
ffd9a43b
...
...
@@ -81,8 +81,8 @@ bool Game::Initialize() {
setPositionFix
(
appPosition
);
device
->
setProcessReceiver
(
this
);
soundEffectPlayer
=
new
AndroidSoundEffectPlayer
(
app
);
soundEffectPlayer
->
setSEEnabled
(
options
->
isSoundEffectEnabled
());
//
soundEffectPlayer = new AndroidSoundEffectPlayer(app);
//
soundEffectPlayer->setSEEnabled(options->isSoundEffectEnabled());
app
->
onInputEvent
=
android
::
handleInput
;
ILogger
*
logger
=
device
->
getLogger
();
// logger->setLogLevel(ELL_WARNING);
...
...
@@ -433,7 +433,7 @@ bool Game::Initialize() {
scrSoundVolume
=
env
->
addScrollBar
(
true
,
rect
<
s32
>
(
posX
+
110
*
xScale
,
posY
,
posX
+
250
*
xScale
,
posY
+
30
*
yScale
),
tabHelper
,
SCROLL_VOLUME
);
scrSoundVolume
->
setMax
(
100
);
scrSoundVolume
->
setMin
(
0
);
scrSoundVolume
->
setPos
(
gameConf
.
sound_volume
*
100
);
scrSoundVolume
->
setPos
(
gameConf
.
sound_volume
);
scrSoundVolume
->
setLargeStep
(
1
);
scrSoundVolume
->
setSmallStep
(
1
);
posY
+=
60
;
...
...
@@ -442,7 +442,7 @@ bool Game::Initialize() {
scrMusicVolume
=
env
->
addScrollBar
(
true
,
rect
<
s32
>
(
posX
+
110
*
xScale
,
posY
,
posX
+
250
*
xScale
,
posY
+
30
*
yScale
),
tabHelper
,
SCROLL_VOLUME
);
scrMusicVolume
->
setMax
(
100
);
scrMusicVolume
->
setMin
(
0
);
scrMusicVolume
->
setPos
(
gameConf
.
music_volume
*
100
);
scrMusicVolume
->
setPos
(
gameConf
.
music_volume
);
scrMusicVolume
->
setLargeStep
(
1
);
scrMusicVolume
->
setSmallStep
(
1
);
elmTabHelperLast
=
chkEnableMusic
;
...
...
@@ -959,7 +959,7 @@ bool Game::Initialize() {
btnCancelOrFinish
=
env
->
addButton
(
rect
<
s32
>
(
205
*
xScale
,
220
*
yScale
,
305
*
xScale
,
275
*
yScale
),
0
,
BUTTON_CANCEL_OR_FINISH
,
dataManager
.
GetSysString
(
1295
));
btnCancelOrFinish
->
setVisible
(
false
);
soundManager
=
Utils
::
make_unique
<
SoundManager
>
();
if
(
!
soundManager
->
Init
(
gameConf
.
sound_volume
,
gameConf
.
music_volume
,
gameConf
.
enable_sound
,
gameConf
.
enable_music
,
nullptr
))
{
if
(
!
soundManager
->
Init
(
(
double
)
gameConf
.
sound_volume
/
100
,
(
double
)
gameConf
.
music_volume
/
100
,
gameConf
.
enable_sound
,
gameConf
.
enable_music
,
nullptr
))
{
chkEnableSound
->
setChecked
(
false
);
chkEnableSound
->
setEnabled
(
false
);
chkEnableSound
->
setVisible
(
false
);
...
...
@@ -1226,7 +1226,7 @@ void Game::MainLoop() {
usleep
(
500000
);
#endif
SaveConfig
();
delete
soundEffectPlayer
;
//
delete soundEffectPlayer;
usleep
(
500000
);
// device->drop();
}
...
...
@@ -1526,10 +1526,10 @@ void Game::SaveConfig() {
gameConf
.
enable_music
=
chkEnableMusic
->
isChecked
()
?
1
:
0
;
android
::
saveIntSetting
(
appMain
,
"enable_music"
,
gameConf
.
enable_music
);
//gameConf.sound_volume =
//
android::saveIntSetting(appMain, "sound_volume", gameConf.sound_volume);
//gameConf.music_volume =
//
android::saveIntSetting(appMain, "music_volume", gameConf.music_volume);
gameConf
.
sound_volume
=
(
double
)
scrSoundVolume
->
getPos
();
android
::
saveIntSetting
(
appMain
,
"sound_volume"
,
gameConf
.
sound_volume
);
gameConf
.
music_volume
=
(
double
)
scrMusicVolume
->
getPos
();
android
::
saveIntSetting
(
appMain
,
"music_volume"
,
gameConf
.
music_volume
);
//gameConf.control_mode = control_mode->isChecked()?1:0;
// android::saveIntSetting(appMain, "control_mode", gameConf.control_mode);
...
...
@@ -1638,10 +1638,12 @@ void Game::AddChatMsg(const wchar_t* msg, int player) {
chatType
[
0
]
=
player
;
switch
(
player
)
{
case
0
:
//from host
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
CHAT
);
chatMsg
[
0
].
append
(
dInfo
.
hostname
);
chatMsg
[
0
].
append
(
L": "
);
break
;
case
1
:
//from client
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
CHAT
);
chatMsg
[
0
].
append
(
dInfo
.
clientname
);
chatMsg
[
0
].
append
(
L": "
);
break
;
...
...
@@ -1650,6 +1652,7 @@ void Game::AddChatMsg(const wchar_t* msg, int player) {
chatMsg
[
0
].
append
(
L": "
);
break
;
case
3
:
//client tag
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
CHAT
);
chatMsg
[
0
].
append
(
dInfo
.
clientname_tag
);
chatMsg
[
0
].
append
(
L": "
);
break
;
...
...
@@ -1658,6 +1661,7 @@ void Game::AddChatMsg(const wchar_t* msg, int player) {
chatMsg
[
0
].
append
(
L": "
);
break
;
case
8
:
//system custom message, no prefix.
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
CHAT
);
chatMsg
[
0
].
append
(
L"[System]: "
);
break
;
case
9
:
//error message
...
...
Classes/gframe/menu_handler.cpp
View file @
ffd9a43b
...
...
@@ -55,15 +55,19 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
}
switch
(
event
.
GUIEvent
.
EventType
)
{
case
irr
:
:
gui
::
EGET_BUTTON_CLICKED
:
{
if
(
id
<
110
)
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
INFO
);
else
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
BUTTON
);
switch
(
id
)
{
case
BUTTON_MODE_EXIT
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
SaveConfig
();
mainGame
->
device
->
closeDevice
();
break
;
}
case
BUTTON_LAN_MODE
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
...
...
@@ -92,6 +96,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
int
status
=
evutil_getaddrinfo
(
hostname
,
port
,
&
hints
,
&
answer
);
if
(
status
!=
0
)
{
mainGame
->
gMutex
.
lock
();
mainGame
->
soundManager
->
PlaySoundEffect
(
SoundManager
::
SFX
::
INFO
);
mainGame
->
env
->
addMessageBox
(
L""
,
dataManager
.
GetSysString
(
1412
));
mainGame
->
gMutex
.
unlock
();
break
;
...
...
@@ -112,7 +117,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_JOIN_CANCEL
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
HideElement
(
mainGame
->
wLanWindow
);
mainGame
->
ShowElement
(
mainGame
->
wMainMenu
);
if
(
exit_on_return
)
...
...
@@ -120,12 +125,12 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_LAN_REFRESH
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
DuelClient
::
BeginRefreshHost
();
break
;
}
case
BUTTON_CREATE_HOST
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
btnHostConfirm
->
setEnabled
(
true
);
mainGame
->
btnHostCancel
->
setEnabled
(
true
);
mainGame
->
HideElement
(
mainGame
->
wLanWindow
);
...
...
@@ -133,7 +138,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_HOST_CONFIRM
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
bot_mode
=
false
;
BufferIO
::
CopyWStr
(
mainGame
->
ebServerName
->
getText
(),
mainGame
->
gameConf
.
gamename
,
20
);
if
(
!
NetServer
::
StartServer
(
mainGame
->
gameConf
.
serverport
))
...
...
@@ -147,7 +152,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_HOST_CANCEL
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
mainGame
->
btnJoinCancel
->
setEnabled
(
true
);
...
...
@@ -156,18 +161,18 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_HP_DUELIST
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
cbDeckSelect
->
setEnabled
(
true
);
DuelClient
::
SendPacketToServer
(
CTOS_HS_TODUELIST
);
break
;
}
case
BUTTON_HP_OBSERVER
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
DuelClient
::
SendPacketToServer
(
CTOS_HS_TOOBSERVER
);
break
;
}
case
BUTTON_HP_KICK
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
int
id
=
0
;
while
(
id
<
4
)
{
if
(
mainGame
->
btnHostPrepKick
[
id
]
==
caller
)
...
...
@@ -180,7 +185,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_HP_READY
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
if
(
mainGame
->
cbCategorySelect
->
getSelected
()
==
-
1
||
mainGame
->
cbDeckSelect
->
getSelected
()
==
-
1
||
!
deckManager
.
LoadDeck
(
mainGame
->
cbCategorySelect
,
mainGame
->
cbDeckSelect
))
{
break
;
...
...
@@ -192,19 +197,19 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_HP_NOTREADY
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
DuelClient
::
SendPacketToServer
(
CTOS_HS_NOTREADY
);
mainGame
->
cbCategorySelect
->
setEnabled
(
true
);
mainGame
->
cbDeckSelect
->
setEnabled
(
true
);
break
;
}
case
BUTTON_HP_START
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
DuelClient
::
SendPacketToServer
(
CTOS_HS_START
);
break
;
}
case
BUTTON_HP_CANCEL
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
DuelClient
::
StopClient
();
mainGame
->
btnCreateHost
->
setEnabled
(
true
);
mainGame
->
btnJoinHost
->
setEnabled
(
true
);
...
...
@@ -223,7 +228,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_REPLAY_MODE
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
HideElement
(
mainGame
->
wMainMenu
);
mainGame
->
ShowElement
(
mainGame
->
wReplay
);
mainGame
->
ebRepStartTurn
->
setText
(
L"1"
);
...
...
@@ -232,7 +237,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_SINGLE_MODE
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
HideElement
(
mainGame
->
wMainMenu
);
mainGame
->
ShowElement
(
mainGame
->
wSinglePlay
);
mainGame
->
RefreshSingleplay
();
...
...
@@ -240,7 +245,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_LOAD_REPLAY
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
if
(
mainGame
->
lstReplayList
->
getSelected
()
==
-
1
)
break
;
if
(
!
ReplayMode
::
cur_replay
.
OpenReplay
(
mainGame
->
lstReplayList
->
getListItem
(
mainGame
->
lstReplayList
->
getSelected
())))
...
...
@@ -293,7 +298,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_CANCEL_REPLAY
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
HideElement
(
mainGame
->
wReplay
);
mainGame
->
ShowElement
(
mainGame
->
wMainMenu
);
break
;
...
...
@@ -406,7 +411,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_LOAD_SINGLEPLAY
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
if
(
mainGame
->
lstSinglePlayList
->
getSelected
()
==
-
1
)
break
;
mainGame
->
singleSignal
.
SetNoWait
(
false
);
...
...
@@ -414,14 +419,14 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break
;
}
case
BUTTON_CANCEL_SINGLEPLAY
:
{
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
mainGame
->
HideElement
(
mainGame
->
wSinglePlay
);
mainGame
->
ShowElement
(
mainGame
->
wMainMenu
);
break
;
}
case
BUTTON_DECK_EDIT
:
{
mainGame
->
RefreshCategoryDeck
(
mainGame
->
cbDBCategory
,
mainGame
->
cbDBDecks
);
mainGame
->
soundEffectPlayer
->
doPressButton
();
//
mainGame->soundEffectPlayer->doPressButton();
if
(
mainGame
->
cbDBCategory
->
getSelected
()
!=
-
1
&&
mainGame
->
cbDBDecks
->
getSelected
()
!=
-
1
)
{
deckManager
.
LoadDeck
(
mainGame
->
cbDBCategory
,
mainGame
->
cbDBDecks
);
mainGame
->
ebDeckname
->
setText
(
L""
);
...
...
Classes/gframe/sound_manager.cpp
View file @
ffd9a43b
#include "sound_manager.h"
#include "config.h"
#include "game.h"
namespace
ygo
{
...
...
@@ -80,12 +81,40 @@ void SoundManager::PlaySoundEffect(SFX sound) {
{
DICE
,
"./sound/diceroll.wav"
},
{
NEXT_TURN
,
"./sound/nextturn.wav"
},
{
PHASE
,
"./sound/phase.wav"
},
{
BUTTON
,
"./sound/button.wav"
},
{
INFO
,
"./sound/info.wav"
},
{
QUESTION
,
"./sound/question.wav"
},
{
CARD_PICK
,
"./sound/cardpick.wav"
},
{
CARD_DROP
,
"./sound/carddrop.wav"
},
{
PLAYER_ENTER
,
"./sound/playerenter.wav"
},
{
CHAT
,
"./sound/chatmessage.wav"
}
};
if
(
!
soundsEnabled
)
return
;
if
(
sfx
)
sfx
->
play
(
fx
.
at
(
sound
),
false
);
}
void
SoundManager
::
PlayDialogSound
(
irr
::
gui
::
IGUIElement
*
element
)
{
if
(
element
==
mainGame
->
wMessage
)
{
PlaySoundEffect
(
SoundManager
::
SFX
::
INFO
);
}
else
if
(
element
==
mainGame
->
wQuery
)
{
PlaySoundEffect
(
SoundManager
::
SFX
::
QUESTION
);
}
else
if
(
element
==
mainGame
->
wSurrender
)
{
PlaySoundEffect
(
SoundManager
::
SFX
::
QUESTION
);
}
else
if
(
element
==
mainGame
->
wOptions
)
{
PlaySoundEffect
(
SoundManager
::
SFX
::
QUESTION
);
}
else
if
(
element
==
mainGame
->
wANAttribute
)
{
PlaySoundEffect
(
SoundManager
::
SFX
::
QUESTION
);
}
else
if
(
element
==
mainGame
->
wANCard
)
{
PlaySoundEffect
(
SoundManager
::
SFX
::
QUESTION
);
}
else
if
(
element
==
mainGame
->
wANNumber
)
{
PlaySoundEffect
(
SoundManager
::
SFX
::
QUESTION
);
}
else
if
(
element
==
mainGame
->
wANRace
)
{
PlaySoundEffect
(
SoundManager
::
SFX
::
QUESTION
);
}
else
if
(
element
==
mainGame
->
wReplaySave
)
{
PlaySoundEffect
(
SoundManager
::
SFX
::
QUESTION
);
}
else
if
(
element
==
mainGame
->
wFTSelect
)
{
PlaySoundEffect
(
SoundManager
::
SFX
::
QUESTION
);
}
}
void
SoundManager
::
PlayMusic
(
const
std
::
string
&
song
,
bool
loop
)
{
if
(
!
musicEnabled
)
return
;
StopBGM
();
...
...
@@ -98,7 +127,7 @@ void SoundManager::PlayBGM(BGM scene) {
bgm_scene
=
scene
;
int
bgm
=
(
std
::
uniform_int_distribution
<>
(
0
,
count
-
1
))(
rnd
);
std
::
string
BGMName
=
"./sound/BGM/"
+
list
[
bgm
];
PlayMusic
(
BGMName
,
tru
e
);
PlayMusic
(
BGMName
,
fals
e
);
}
}
void
SoundManager
::
StopBGM
()
{
...
...
Classes/gframe/sound_manager.h
View file @
ffd9a43b
...
...
@@ -32,6 +32,11 @@ public:
DICE
,
NEXT_TURN
,
PHASE
,
BUTTON
,
INFO
,
QUESTION
,
CARD_PICK
,
CARD_DROP
,
PLAYER_ENTER
,
CHAT
};
...
...
@@ -48,6 +53,7 @@ public:
bool
Init
(
double
sounds_volume
,
double
music_volume
,
bool
sounds_enabled
,
bool
music_enabled
,
void
*
payload
=
nullptr
);
void
RefreshBGMList
();
void
PlaySoundEffect
(
SFX
sound
);
void
PlayDialogSound
(
irr
::
gui
::
IGUIElement
*
element
);
void
PlayMusic
(
const
std
::
string
&
song
,
bool
loop
);
void
PlayBGM
(
BGM
scene
);
void
StopBGM
();
...
...
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