Commit ffd9a43b authored by Unicorn369's avatar Unicorn369 Committed by fallenstardust

update

parent cb8715a6
...@@ -223,9 +223,10 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -223,9 +223,10 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
* } * }
* }*/ * }*/
case irr::gui::EGET_BUTTON_CLICKED: { case irr::gui::EGET_BUTTON_CLICKED: {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
switch(id) { switch(id) {
case BUTTON_CLEAR_DECK: { case BUTTON_CLEAR_DECK: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->gMutex.lock(); mainGame->gMutex.lock();
mainGame->SetStaticText(mainGame->stQMessage, 370, mainGame->textFont, dataManager.GetSysString(1339)); mainGame->SetStaticText(mainGame->stQMessage, 370, mainGame->textFont, dataManager.GetSysString(1339));
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
...@@ -234,14 +235,14 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -234,14 +235,14 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_SORT_DECK: { 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.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.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); std::sort(deckManager.current_deck.side.begin(), deckManager.current_deck.side.end(), ClientCard::deck_sort_lv);
break; break;
} }
case BUTTON_SHUFFLE_DECK: { case BUTTON_SHUFFLE_DECK: {
mainGame->soundEffectPlayer->doShuffleCardEffect(); //mainGame->soundEffectPlayer->doShuffleCardEffect();
std::random_shuffle(deckManager.current_deck.main.begin(), deckManager.current_deck.main.end()); std::random_shuffle(deckManager.current_deck.main.begin(), deckManager.current_deck.main.end());
break; break;
} }
...@@ -255,7 +256,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -255,7 +256,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
mainGame->stACMessage->setText(dataManager.GetSysString(1335)); mainGame->stACMessage->setText(dataManager.GetSysString(1335));
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
is_modified = false; is_modified = false;
mainGame->soundEffectPlayer->doSaveDeck(); //mainGame->soundEffectPlayer->doSaveDeck();
} }
break; break;
} }
...@@ -284,7 +285,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -284,7 +285,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
mainGame->stACMessage->setText(dataManager.GetSysString(1335)); mainGame->stACMessage->setText(dataManager.GetSysString(1335));
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
is_modified = false; is_modified = false;
mainGame->soundEffectPlayer->doSaveDeck(); //mainGame->soundEffectPlayer->doSaveDeck();
} }
break; break;
} }
...@@ -300,7 +301,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -300,7 +301,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
mainGame->gMutex.unlock(); mainGame->gMutex.unlock();
prev_operation = id; prev_operation = id;
prev_sel = sel; prev_sel = sel;
mainGame->soundEffectPlayer->doDelete(); //mainGame->soundEffectPlayer->doDelete();
break; break;
} }
case BUTTON_LEAVE_GAME: { case BUTTON_LEAVE_GAME: {
...@@ -312,12 +313,12 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -312,12 +313,12 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
prev_operation = id; prev_operation = id;
break; break;
} }
mainGame->soundEffectPlayer->doLeave(); //mainGame->soundEffectPlayer->doLeave();
Terminate(); Terminate();
break; break;
} }
case BUTTON_EFFECT_FILTER: { case BUTTON_EFFECT_FILTER: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->PopupElement(mainGame->wCategories); mainGame->PopupElement(mainGame->wCategories);
break; break;
} }
...@@ -328,12 +329,12 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -328,12 +329,12 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_CLEAR_FILTER: { case BUTTON_CLEAR_FILTER: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
ClearSearch(); ClearSearch();
break; break;
} }
case BUTTON_CATEGORY_OK: { case BUTTON_CATEGORY_OK: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
filter_effect = 0; filter_effect = 0;
long long filter = 0x1; long long filter = 0x1;
for(int i = 0; i < 32; ++i, filter <<= 1) for(int i = 0; i < 32; ++i, filter <<= 1)
...@@ -345,7 +346,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -345,7 +346,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_MANAGE_DECK: { case BUTTON_MANAGE_DECK: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
if(is_modified && !readonly && !mainGame->chkIgnoreDeckChanges->isChecked()) { if(is_modified && !readonly && !mainGame->chkIgnoreDeckChanges->isChecked()) {
mainGame->gMutex.lock(); mainGame->gMutex.lock();
mainGame->SetStaticText(mainGame->stQMessage, 370 * mainGame->xScale, mainGame->guiFont, dataManager.GetSysString(1356)); mainGame->SetStaticText(mainGame->stQMessage, 370 * mainGame->xScale, mainGame->guiFont, dataManager.GetSysString(1356));
...@@ -358,7 +359,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -358,7 +359,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_NEW_CATEGORY: { case BUTTON_NEW_CATEGORY: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->gMutex.lock(); mainGame->gMutex.lock();
mainGame->stDMMessage->setText(dataManager.GetSysString(1469)); mainGame->stDMMessage->setText(dataManager.GetSysString(1469));
mainGame->ebDMName->setVisible(true); mainGame->ebDMName->setVisible(true);
...@@ -369,7 +370,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -369,7 +370,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_RENAME_CATEGORY: { case BUTTON_RENAME_CATEGORY: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
if(mainGame->lstCategories->getSelected() < 4) if(mainGame->lstCategories->getSelected() < 4)
break; break;
mainGame->gMutex.lock(); mainGame->gMutex.lock();
...@@ -382,7 +383,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -382,7 +383,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_DELETE_CATEGORY: { case BUTTON_DELETE_CATEGORY: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->gMutex.lock(); mainGame->gMutex.lock();
mainGame->stDMMessage->setText(dataManager.GetSysString(1470)); mainGame->stDMMessage->setText(dataManager.GetSysString(1470));
mainGame->stDMMessage2->setVisible(true); mainGame->stDMMessage2->setVisible(true);
...@@ -393,7 +394,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -393,7 +394,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_NEW_DECK: { case BUTTON_NEW_DECK: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->gMutex.lock(); mainGame->gMutex.lock();
mainGame->stDMMessage->setText(dataManager.GetSysString(1471)); mainGame->stDMMessage->setText(dataManager.GetSysString(1471));
mainGame->ebDMName->setVisible(true); mainGame->ebDMName->setVisible(true);
...@@ -404,7 +405,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -404,7 +405,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_RENAME_DECK: { case BUTTON_RENAME_DECK: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->gMutex.lock(); mainGame->gMutex.lock();
mainGame->stDMMessage->setText(dataManager.GetSysString(1471)); mainGame->stDMMessage->setText(dataManager.GetSysString(1471));
mainGame->ebDMName->setVisible(true); mainGame->ebDMName->setVisible(true);
...@@ -415,7 +416,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -415,7 +416,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_DELETE_DECK_DM: { case BUTTON_DELETE_DECK_DM: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->gMutex.lock(); mainGame->gMutex.lock();
mainGame->stDMMessage->setText(dataManager.GetSysString(1337)); mainGame->stDMMessage->setText(dataManager.GetSysString(1337));
mainGame->stDMMessage2->setVisible(true); mainGame->stDMMessage2->setVisible(true);
...@@ -426,7 +427,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -426,7 +427,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_MOVE_DECK: { case BUTTON_MOVE_DECK: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->gMutex.lock(); mainGame->gMutex.lock();
mainGame->stDMMessage->setText(dataManager.GetSysString(1472)); mainGame->stDMMessage->setText(dataManager.GetSysString(1472));
mainGame->cbDMCategory->setVisible(true); mainGame->cbDMCategory->setVisible(true);
...@@ -444,7 +445,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -444,7 +445,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_COPY_DECK: { case BUTTON_COPY_DECK: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->gMutex.lock(); mainGame->gMutex.lock();
mainGame->stDMMessage->setText(dataManager.GetSysString(1473)); mainGame->stDMMessage->setText(dataManager.GetSysString(1473));
mainGame->cbDMCategory->setVisible(true); mainGame->cbDMCategory->setVisible(true);
...@@ -462,7 +463,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -462,7 +463,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_DM_OK: { case BUTTON_DM_OK: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
switch(prev_operation) { switch(prev_operation) {
case BUTTON_NEW_CATEGORY: { case BUTTON_NEW_CATEGORY: {
int catesel = 0; int catesel = 0;
...@@ -492,7 +493,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -492,7 +493,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_RENAME_CATEGORY: { case BUTTON_RENAME_CATEGORY: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
int catesel = mainGame->lstCategories->getSelected(); int catesel = mainGame->lstCategories->getSelected();
const wchar_t* oldcatename = mainGame->lstCategories->getListItem(catesel); const wchar_t* oldcatename = mainGame->lstCategories->getListItem(catesel);
const wchar_t* newcatename = mainGame->ebDMName->getText(); const wchar_t* newcatename = mainGame->ebDMName->getText();
...@@ -523,7 +524,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -523,7 +524,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_DELETE_CATEGORY: { case BUTTON_DELETE_CATEGORY: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
int catesel = mainGame->lstCategories->getSelected(); int catesel = mainGame->lstCategories->getSelected();
const wchar_t* catename = mainGame->lstCategories->getListItem(catesel); const wchar_t* catename = mainGame->lstCategories->getListItem(catesel);
if(deckManager.DeleteCategory(catename)) { if(deckManager.DeleteCategory(catename)) {
...@@ -542,7 +543,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -542,7 +543,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_NEW_DECK: { case BUTTON_NEW_DECK: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
const wchar_t* deckname = mainGame->ebDMName->getText(); const wchar_t* deckname = mainGame->ebDMName->getText();
wchar_t catepath[256]; wchar_t catepath[256];
deckManager.GetCategoryPath(catepath, mainGame->cbDBCategory->getSelected(), mainGame->cbDBCategory->getText()); deckManager.GetCategoryPath(catepath, mainGame->cbDBCategory->getSelected(), mainGame->cbDBCategory->getText());
...@@ -573,7 +574,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -573,7 +574,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_RENAME_DECK: { case BUTTON_RENAME_DECK: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
int catesel = mainGame->lstCategories->getSelected(); int catesel = mainGame->lstCategories->getSelected();
int decksel = mainGame->lstDecks->getSelected(); int decksel = mainGame->lstDecks->getSelected();
const wchar_t* catename = mainGame->lstCategories->getListItem(catesel); const wchar_t* catename = mainGame->lstCategories->getListItem(catesel);
...@@ -608,7 +609,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -608,7 +609,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_DELETE_DECK_DM: { case BUTTON_DELETE_DECK_DM: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
int decksel = mainGame->lstDecks->getSelected(); int decksel = mainGame->lstDecks->getSelected();
wchar_t filepath[256]; wchar_t filepath[256];
deckManager.GetDeckFile(filepath, mainGame->cbDBCategory, mainGame->cbDBDecks); deckManager.GetDeckFile(filepath, mainGame->cbDBCategory, mainGame->cbDBDecks);
...@@ -633,7 +634,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -633,7 +634,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_MOVE_DECK: { case BUTTON_MOVE_DECK: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
int oldcatesel = mainGame->lstCategories->getSelected(); int oldcatesel = mainGame->lstCategories->getSelected();
int newcatesel = mainGame->cbDMCategory->getSelected(); int newcatesel = mainGame->cbDMCategory->getSelected();
int decksel = mainGame->lstDecks->getSelected(); int decksel = mainGame->lstDecks->getSelected();
...@@ -674,7 +675,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -674,7 +675,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_COPY_DECK: { case BUTTON_COPY_DECK: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
int oldcatesel = mainGame->lstCategories->getSelected(); int oldcatesel = mainGame->lstCategories->getSelected();
int newcatesel = mainGame->cbDMCategory->getSelected(); int newcatesel = mainGame->cbDMCategory->getSelected();
int decksel = mainGame->lstDecks->getSelected(); int decksel = mainGame->lstDecks->getSelected();
...@@ -723,7 +724,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -723,7 +724,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_DM_CANCEL: { case BUTTON_DM_CANCEL: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->HideElement(mainGame->wDMQuery); mainGame->HideElement(mainGame->wDMQuery);
mainGame->stDMMessage2->setVisible(false); mainGame->stDMMessage2->setVisible(false);
mainGame->ebDMName->setVisible(false); mainGame->ebDMName->setVisible(false);
...@@ -731,14 +732,15 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -731,14 +732,15 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_CLOSE_DECKMANAGER: { case BUTTON_CLOSE_DECKMANAGER: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->HideElement(mainGame->wDeckManage); mainGame->HideElement(mainGame->wDeckManage);
break; break;
} }
case BUTTON_SIDE_OK: { 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 if(deckManager.current_deck.main.size() != pre_mainc || deckManager.current_deck.extra.size() != pre_extrac
|| deckManager.current_deck.side.size() != pre_sidec) { || deckManager.current_deck.side.size() != pre_sidec) {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::INFO);
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1410)); mainGame->env->addMessageBox(L"", dataManager.GetSysString(1410));
break; break;
} }
...@@ -766,7 +768,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -766,7 +768,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_YES: { case BUTTON_YES: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->HideElement(mainGame->wQuery); mainGame->HideElement(mainGame->wQuery);
if(!mainGame->is_building || mainGame->is_siding) if(!mainGame->is_building || mainGame->is_siding)
break; break;
...@@ -810,7 +812,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -810,7 +812,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_NO: { case BUTTON_NO: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->HideElement(mainGame->wQuery); mainGame->HideElement(mainGame->wQuery);
if(prev_operation == COMBOBOX_DBCATEGORY) { if(prev_operation == COMBOBOX_DBCATEGORY) {
mainGame->cbDBCategory->setSelected(prev_category); mainGame->cbDBCategory->setSelected(prev_category);
...@@ -1125,6 +1127,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -1125,6 +1127,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->soundManager->PlaySoundEffect(SoundManager::SFX::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);
...@@ -1154,6 +1157,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -1154,6 +1157,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->soundManager->PlaySoundEffect(SoundManager::SFX::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);
...@@ -1171,6 +1175,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -1171,6 +1175,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->soundManager->PlaySoundEffect(SoundManager::SFX::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) {
...@@ -1213,6 +1218,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -1213,6 +1218,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->soundManager->PlaySoundEffect(SoundManager::SFX::CARD_PICK);
if (hovered_pos == 1) { if (hovered_pos == 1) {
if(!push_main(pointer)) if(!push_main(pointer))
push_side(pointer); push_side(pointer);
...@@ -1231,6 +1237,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -1231,6 +1237,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->soundManager->PlaySoundEffect(SoundManager::SFX::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)
......
...@@ -1135,6 +1135,7 @@ void Game::HideElement(irr::gui::IGUIElement * win, bool set_action) { ...@@ -1135,6 +1135,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) {
mainGame->soundManager->PlayDialogSound(element);
element->getParent()->bringToFront(element); element->getParent()->bringToFront(element);
if(!is_building) if(!is_building)
dField.panel = element; dField.panel = element;
......
...@@ -84,6 +84,7 @@ void DuelClient::ConnectTimeout(evutil_socket_t fd, short events, void* arg) { ...@@ -84,6 +84,7 @@ void DuelClient::ConnectTimeout(evutil_socket_t fd, short events, void* arg) {
mainGame->ShowElement(mainGame->wSinglePlay); mainGame->ShowElement(mainGame->wSinglePlay);
else if(!bot_mode && !mainGame->wLanWindow->isVisible()) else if(!bot_mode && !mainGame->wLanWindow->isVisible())
mainGame->ShowElement(mainGame->wLanWindow); mainGame->ShowElement(mainGame->wLanWindow);
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::INFO);
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1400)); mainGame->env->addMessageBox(L"", dataManager.GetSysString(1400));
mainGame->gMutex.unlock(); mainGame->gMutex.unlock();
} }
...@@ -174,6 +175,7 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) { ...@@ -174,6 +175,7 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
mainGame->ShowElement(mainGame->wSinglePlay); mainGame->ShowElement(mainGame->wSinglePlay);
else if(!bot_mode && !mainGame->wLanWindow->isVisible()) else if(!bot_mode && !mainGame->wLanWindow->isVisible())
mainGame->ShowElement(mainGame->wLanWindow); mainGame->ShowElement(mainGame->wLanWindow);
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::INFO);
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1400)); mainGame->env->addMessageBox(L"", dataManager.GetSysString(1400));
mainGame->gMutex.unlock(); mainGame->gMutex.unlock();
} else if(connect_state == 0x7) { } else if(connect_state == 0x7) {
...@@ -190,12 +192,14 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) { ...@@ -190,12 +192,14 @@ void DuelClient::ClientEvent(bufferevent *bev, short events, void *ctx) {
else else
mainGame->ShowElement(mainGame->wLanWindow); mainGame->ShowElement(mainGame->wLanWindow);
mainGame->wChat->setVisible(false); mainGame->wChat->setVisible(false);
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::INFO);
if(events & BEV_EVENT_EOF) if(events & BEV_EVENT_EOF)
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1401)); mainGame->env->addMessageBox(L"", dataManager.GetSysString(1401));
else mainGame->env->addMessageBox(L"", dataManager.GetSysString(1402)); else mainGame->env->addMessageBox(L"", dataManager.GetSysString(1402));
mainGame->gMutex.unlock(); mainGame->gMutex.unlock();
} else { } else {
mainGame->gMutex.lock(); mainGame->gMutex.lock();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::INFO);
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1502)); mainGame->env->addMessageBox(L"", dataManager.GetSysString(1502));
mainGame->btnCreateHost->setEnabled(true); mainGame->btnCreateHost->setEnabled(true);
mainGame->btnJoinHost->setEnabled(true); mainGame->btnJoinHost->setEnabled(true);
...@@ -250,6 +254,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -250,6 +254,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->btnStartBot->setEnabled(true); mainGame->btnStartBot->setEnabled(true);
mainGame->btnBotCancel->setEnabled(true); mainGame->btnBotCancel->setEnabled(true);
mainGame->gMutex.lock(); mainGame->gMutex.lock();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::INFO);
if(pkt->code == 0) if(pkt->code == 0)
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1403)); mainGame->env->addMessageBox(L"", dataManager.GetSysString(1403));
else if(pkt->code == 1) else if(pkt->code == 1)
...@@ -307,6 +312,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -307,6 +312,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
break; break;
} }
} }
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::INFO);
mainGame->env->addMessageBox(L"", msgbuf); mainGame->env->addMessageBox(L"", msgbuf);
mainGame->cbCategorySelect->setEnabled(true); mainGame->cbCategorySelect->setEnabled(true);
mainGame->cbDeckSelect->setEnabled(true); mainGame->cbDeckSelect->setEnabled(true);
...@@ -315,6 +321,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -315,6 +321,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
} }
case ERRMSG_SIDEERROR: { case ERRMSG_SIDEERROR: {
mainGame->gMutex.lock(); mainGame->gMutex.lock();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::INFO);
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1408)); mainGame->env->addMessageBox(L"", dataManager.GetSysString(1408));
mainGame->gMutex.unlock(); mainGame->gMutex.unlock();
break; break;
...@@ -328,6 +335,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -328,6 +335,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->gMutex.lock(); mainGame->gMutex.lock();
wchar_t msgbuf[256]; wchar_t msgbuf[256];
myswprintf(msgbuf, dataManager.GetSysString(1411), pkt->code >> 12, (pkt->code >> 4) & 0xff, pkt->code & 0xf); 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->env->addMessageBox(L"", msgbuf);
mainGame->gMutex.unlock(); mainGame->gMutex.unlock();
event_base_loopbreak(client_base); event_base_loopbreak(client_base);
...@@ -405,7 +413,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -405,7 +413,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
break; break;
} }
case STOC_JOIN_GAME: { case STOC_JOIN_GAME: {
mainGame->soundEffectPlayer->doPlayerEnterEffect(); //mainGame->soundEffectPlayer->doPlayerEnterEffect();
STOC_JoinGame* pkt = (STOC_JoinGame*)pdata; STOC_JoinGame* pkt = (STOC_JoinGame*)pdata;
std::wstring str; std::wstring str;
wchar_t msgbuf[256]; wchar_t msgbuf[256];
...@@ -564,7 +572,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -564,7 +572,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
break; break;
} }
case STOC_DUEL_START: { case STOC_DUEL_START: {
mainGame->soundEffectPlayer->doStartGame(); //mainGame->soundEffectPlayer->doStartGame();
mainGame->HideElement(mainGame->wHostPrepare); mainGame->HideElement(mainGame->wHostPrepare);
mainGame->WaitFrameSignal(11); mainGame->WaitFrameSignal(11);
mainGame->gMutex.lock(); mainGame->gMutex.lock();
...@@ -773,7 +781,8 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -773,7 +781,8 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
break; break;
} }
case STOC_HS_PLAYER_ENTER: { 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; STOC_HS_PlayerEnter* pkt = (STOC_HS_PlayerEnter*)pdata;
if(pkt->pos > 3) if(pkt->pos > 3)
break; break;
...@@ -807,7 +816,8 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -807,7 +816,8 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
break; break;
mainGame->gMutex.lock(); mainGame->gMutex.lock();
if(state < 8) { 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(); 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"");
...@@ -833,7 +843,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) { ...@@ -833,7 +843,7 @@ void DuelClient::HandleSTOCPacketLan(char* data, unsigned int len) {
mainGame->btnHostPrepNotReady->setVisible(false); mainGame->btnHostPrepNotReady->setVisible(false);
} }
} else if(state == PLAYERCHANGE_LEAVE) { } else if(state == PLAYERCHANGE_LEAVE) {
mainGame->soundEffectPlayer->doPlayerExit(); //mainGame->soundEffectPlayer->doPlayerExit();
mainGame->stHostPrepDuelist[pos]->setText(L""); mainGame->stHostPrepDuelist[pos]->setText(L"");
mainGame->chkHostPrepReady[pos]->setChecked(false); mainGame->chkHostPrepReady[pos]->setChecked(false);
} else if(state == PLAYERCHANGE_OBSERVE) { } else if(state == PLAYERCHANGE_OBSERVE) {
...@@ -1942,6 +1952,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1942,6 +1952,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->soundManager->PlaySoundEffect(SoundManager::SFX::REVEAL);
myswprintf(textBuffer, dataManager.GetSysString(207), count); myswprintf(textBuffer, dataManager.GetSysString(207), count);
mainGame->AddLog(textBuffer); mainGame->AddLog(textBuffer);
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
...@@ -1979,6 +1990,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -1979,6 +1990,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->soundManager->PlaySoundEffect(SoundManager::SFX::REVEAL);
myswprintf(textBuffer, dataManager.GetSysString(207), count); myswprintf(textBuffer, dataManager.GetSysString(207), count);
mainGame->AddLog(textBuffer); mainGame->AddLog(textBuffer);
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
...@@ -2011,6 +2023,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2011,6 +2023,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pbuf += count * 7; pbuf += count * 7;
return true; return true;
} }
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::REVEAL);
myswprintf(textBuffer, dataManager.GetSysString(208), count); myswprintf(textBuffer, dataManager.GetSysString(208), count);
mainGame->AddLog(textBuffer); mainGame->AddLog(textBuffer);
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
...@@ -2100,7 +2113,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2100,7 +2113,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_SHUFFLE_DECK: { case MSG_SHUFFLE_DECK: {
mainGame->soundEffectPlayer->doShuffleCardEffect(); //mainGame->soundEffectPlayer->doShuffleCardEffect();
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
if(mainGame->dField.deck[player].size() < 2) if(mainGame->dField.deck[player].size() < 2)
return true; return true;
...@@ -2118,6 +2131,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2118,6 +2131,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->soundManager->PlaySoundEffect(SoundManager::SFX::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.4f / RAND_MAX - 0.2f, 0, 0); (*cit)->dPos = irr::core::vector3df(rand() * 0.4f / RAND_MAX - 0.2f, 0, 0);
...@@ -2143,7 +2157,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2143,7 +2157,8 @@ 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->soundEffectPlayer->doShuffleCardEffect(); //mainGame->soundEffectPlayer->doShuffleCardEffect();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::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;
...@@ -2188,7 +2203,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2188,7 +2203,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
if(count > 1) if(count > 1)
mainGame->soundEffectPlayer->doShuffleCardEffect(); //mainGame->soundEffectPlayer->doShuffleCardEffect();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::SHUFFLE);
for (int i = 0; i < 5; ++i) { for (int i = 0; i < 5; ++i) {
for (auto cit = mainGame->dField.extra[player].begin(); cit != mainGame->dField.extra[player].end(); ++cit) { for (auto cit = mainGame->dField.extra[player].begin(); cit != mainGame->dField.extra[player].end(); ++cit) {
if(!((*cit)->position & POS_FACEUP)) { if(!((*cit)->position & POS_FACEUP)) {
...@@ -2323,6 +2339,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2323,6 +2339,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
} }
} }
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) { if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::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 (auto cit = mc[i]->overlayed.begin(); cit != mc[i]->overlayed.end(); ++cit) 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) { ...@@ -2333,7 +2350,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_NEW_TURN: { case MSG_NEW_TURN: {
mainGame->soundEffectPlayer->doNewTurnEffect(); //mainGame->soundEffectPlayer->doNewTurnEffect();
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
mainGame->dInfo.turn++; mainGame->dInfo.turn++;
if(!mainGame->dInfo.isTag && !mainGame->dInfo.isReplay && mainGame->dInfo.player_type < 7) { if(!mainGame->dInfo.isTag && !mainGame->dInfo.isReplay && mainGame->dInfo.player_type < 7) {
...@@ -2362,6 +2379,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2362,6 +2379,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->soundManager->PlaySoundEffect(SoundManager::SFX::NEXT_TURN);
mainGame->showcardcode = 10; mainGame->showcardcode = 10;
mainGame->showcarddif = 30; mainGame->showcarddif = 30;
mainGame->showcardp = 0; mainGame->showcardp = 0;
...@@ -2372,7 +2390,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2372,7 +2390,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_NEW_PHASE: { case MSG_NEW_PHASE: {
mainGame->soundEffectPlayer->doNewPhaseEffect(); //mainGame->soundEffectPlayer->doNewPhaseEffect();
unsigned short phase = BufferIO::ReadInt16(pbuf); unsigned short phase = BufferIO::ReadInt16(pbuf);
mainGame->btnPhaseStatus->setVisible(false); mainGame->btnPhaseStatus->setVisible(false);
mainGame->btnBP->setVisible(false); mainGame->btnBP->setVisible(false);
...@@ -2411,6 +2429,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2411,6 +2429,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->soundManager->PlaySoundEffect(SoundManager::SFX::PHASE);
mainGame->showcard = 101; mainGame->showcard = 101;
mainGame->WaitFrameSignal(40); mainGame->WaitFrameSignal(40);
mainGame->showcard = 0; mainGame->showcard = 0;
...@@ -2429,7 +2448,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2429,7 +2448,11 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int cp = BufferIO::ReadInt8(pbuf); int cp = BufferIO::ReadInt8(pbuf);
int reason = BufferIO::ReadInt32(pbuf); int reason = BufferIO::ReadInt32(pbuf);
if (!mainGame->dInfo.isReplaySkiping && reason & REASON_DESTROY && pl != cl) { 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) { if (pl == 0) {
ClientCard* pcard = new ClientCard(); ClientCard* pcard = new ClientCard();
...@@ -2646,7 +2669,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2646,7 +2669,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_SET: { case MSG_SET: {
mainGame->soundEffectPlayer->doSetCardEffect(); //mainGame->soundEffectPlayer->doSetCardEffect();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::SET);
/*int code = */BufferIO::ReadInt32(pbuf); /*int code = */BufferIO::ReadInt32(pbuf);
/*int cc = mainGame->LocalPlayer*/(BufferIO::ReadInt8(pbuf)); /*int cc = mainGame->LocalPlayer*/(BufferIO::ReadInt8(pbuf));
/*int cl = */BufferIO::ReadInt8(pbuf); /*int cl = */BufferIO::ReadInt8(pbuf);
...@@ -2699,12 +2723,14 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2699,12 +2723,14 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_SUMMONING: { case MSG_SUMMONING: {
mainGame->soundEffectPlayer->doSummonEffect(); //mainGame->soundEffectPlayer->doSummonEffect();
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf); unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf);
/*int cc = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); /*int cc = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
/*int cl = */BufferIO::ReadInt8(pbuf); /*int cl = */BufferIO::ReadInt8(pbuf);
/*int cs = */BufferIO::ReadInt8(pbuf); /*int cs = */BufferIO::ReadInt8(pbuf);
/*int cp = */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) { if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
myswprintf(event_string, dataManager.GetSysString(1603), dataManager.GetName(code)); myswprintf(event_string, dataManager.GetSysString(1603), dataManager.GetName(code));
mainGame->showcardcode = code; mainGame->showcardcode = code;
...@@ -2722,13 +2748,19 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2722,13 +2748,19 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_SPSUMMONING: { case MSG_SPSUMMONING: {
mainGame->soundEffectPlayer->doSpecialSummonEffect(); //mainGame->soundEffectPlayer->doSpecialSummonEffect();
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf); unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf);
/*int cc = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); /*int cc = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
/*int cl = */BufferIO::ReadInt8(pbuf); /*int cl = */BufferIO::ReadInt8(pbuf);
/*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) {
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)); myswprintf(event_string, dataManager.GetSysString(1605), dataManager.GetName(code));
mainGame->showcardcode = code; mainGame->showcardcode = code;
mainGame->showcarddif = 1; mainGame->showcarddif = 1;
...@@ -2744,7 +2776,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2744,7 +2776,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_FLIPSUMMONING: { case MSG_FLIPSUMMONING: {
mainGame->soundEffectPlayer->doFlipCardEffect(); //mainGame->soundEffectPlayer->doFlipCardEffect();
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf); unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf);
int cc = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int cc = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int cl = BufferIO::ReadInt8(pbuf); int cl = BufferIO::ReadInt8(pbuf);
...@@ -2754,6 +2786,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2754,6 +2786,8 @@ 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) {
if(!mainGame->soundManager->PlayChant(code))
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::FLIP);
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);
...@@ -2772,7 +2806,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2772,7 +2806,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_CHAINING: { case MSG_CHAINING: {
mainGame->soundEffectPlayer->doActivateEffect(); //mainGame->soundEffectPlayer->doActivateEffect();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::ACTIVATE);
unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf); unsigned int code = (unsigned int)BufferIO::ReadInt32(pbuf);
int pcc = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int pcc = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int pcl = BufferIO::ReadInt8(pbuf); int pcl = BufferIO::ReadInt8(pbuf);
...@@ -2896,6 +2931,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2896,6 +2931,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
pbuf += count * 4; pbuf += count * 4;
return true; return true;
} }
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::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));
...@@ -2914,6 +2950,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2914,6 +2950,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_BECOME_TARGET: { case MSG_BECOME_TARGET: {
//mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::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;
...@@ -2969,7 +3006,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2969,7 +3006,8 @@ 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->soundEffectPlayer->doDrawCardEffect(); //mainGame->soundEffectPlayer->doDrawCardEffect();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::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);
...@@ -2986,7 +3024,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -2986,7 +3024,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_DAMAGE: { case MSG_DAMAGE: {
mainGame->soundEffectPlayer->doDamageEffect(); //mainGame->soundEffectPlayer->doDamageEffect();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::DAMAGE);
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int val = BufferIO::ReadInt32(pbuf); int val = BufferIO::ReadInt32(pbuf);
int final = mainGame->dInfo.lp[player] - val; int final = mainGame->dInfo.lp[player] - val;
...@@ -3017,7 +3056,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3017,7 +3056,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_RECOVER: { case MSG_RECOVER: {
mainGame->soundEffectPlayer->doGainLpEffect(); //mainGame->soundEffectPlayer->doGainLpEffect();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::RECOVER);
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int val = BufferIO::ReadInt32(pbuf); int val = BufferIO::ReadInt32(pbuf);
int final = mainGame->dInfo.lp[player] + val; int final = mainGame->dInfo.lp[player] + val;
...@@ -3046,7 +3086,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3046,7 +3086,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_EQUIP: { case MSG_EQUIP: {
mainGame->soundEffectPlayer->doEquipEffect(); //mainGame->soundEffectPlayer->doEquipEffect();
int c1 = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int c1 = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int l1 = BufferIO::ReadInt8(pbuf); int l1 = BufferIO::ReadInt8(pbuf);
int s1 = BufferIO::ReadInt8(pbuf); int s1 = BufferIO::ReadInt8(pbuf);
...@@ -3063,6 +3103,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3063,6 +3103,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->soundManager->PlaySoundEffect(SoundManager::SFX::EQUIP);
mainGame->gMutex.lock(); mainGame->gMutex.lock();
if(pc1->equipTarget) { if(pc1->equipTarget) {
pc1->is_showequip = false; pc1->is_showequip = false;
...@@ -3171,7 +3212,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3171,7 +3212,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
break; break;
} }
case MSG_PAY_LPCOST: { case MSG_PAY_LPCOST: {
mainGame->soundEffectPlayer->doDamageEffect(); //mainGame->soundEffectPlayer->doDamageEffect();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::DAMAGE);
int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int player = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int cost = BufferIO::ReadInt32(pbuf); int cost = BufferIO::ReadInt32(pbuf);
int final = mainGame->dInfo.lp[player] - cost; int final = mainGame->dInfo.lp[player] - cost;
...@@ -3198,7 +3240,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3198,7 +3240,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_ADD_COUNTER: { case MSG_ADD_COUNTER: {
mainGame->soundEffectPlayer->doAddCounterEffect(); //mainGame->soundEffectPlayer->doAddCounterEffect();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::COUNTER_ADD);
int type = BufferIO::ReadInt16(pbuf); int type = BufferIO::ReadInt16(pbuf);
int c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int l = BufferIO::ReadInt8(pbuf); int l = BufferIO::ReadInt8(pbuf);
...@@ -3221,7 +3264,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3221,7 +3264,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_REMOVE_COUNTER: { case MSG_REMOVE_COUNTER: {
mainGame->soundEffectPlayer->doRemoveCounterEffect(); //mainGame->soundEffectPlayer->doRemoveCounterEffect();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::COUNTER_REMOVE);
int type = BufferIO::ReadInt16(pbuf); int type = BufferIO::ReadInt16(pbuf);
int c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int c = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int l = BufferIO::ReadInt8(pbuf); int l = BufferIO::ReadInt8(pbuf);
...@@ -3244,7 +3288,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3244,7 +3288,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_ATTACK: { case MSG_ATTACK: {
mainGame->soundEffectPlayer->doAttackEffect(); //mainGame->soundEffectPlayer->doAttackEffect();
int ca = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); int ca = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int la = BufferIO::ReadInt8(pbuf); int la = BufferIO::ReadInt8(pbuf);
int sa = BufferIO::ReadInt8(pbuf); int sa = BufferIO::ReadInt8(pbuf);
...@@ -3258,6 +3302,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3258,6 +3302,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
float sy; float sy;
if (ld != 0) { if (ld != 0) {
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::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));
...@@ -3272,6 +3317,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3272,6 +3317,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->soundManager->PlaySoundEffect(SoundManager::SFX::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;
...@@ -3352,7 +3398,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3352,7 +3398,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_TOSS_COIN: { case MSG_TOSS_COIN: {
mainGame->soundEffectPlayer->doCoinFlipEffect(); //mainGame->soundEffectPlayer->doCoinFlipEffect();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::COIN);
/*int player = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); /*int player = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadInt8(pbuf);
wchar_t* pwbuf = textBuffer; wchar_t* pwbuf = textBuffer;
...@@ -3375,7 +3422,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) { ...@@ -3375,7 +3422,8 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
return true; return true;
} }
case MSG_TOSS_DICE: { case MSG_TOSS_DICE: {
mainGame->soundEffectPlayer->doDiceRollEffect(); //mainGame->soundEffectPlayer->doDiceRollEffect();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::DICE);
/*int player = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf)); /*int player = */mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int count = BufferIO::ReadInt8(pbuf); int count = BufferIO::ReadInt8(pbuf);
wchar_t* pwbuf = textBuffer; wchar_t* pwbuf = textBuffer;
......
...@@ -50,7 +50,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -50,7 +50,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
} }
case BUTTON_FIRST: case BUTTON_FIRST:
case BUTTON_SECOND: { case BUTTON_SECOND: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::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;
...@@ -58,7 +59,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -58,7 +59,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_REPLAY_START: { case BUTTON_REPLAY_START: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
if(!mainGame->dInfo.isReplay) if(!mainGame->dInfo.isReplay)
break; break;
mainGame->btnReplayStart->setVisible(false); mainGame->btnReplayStart->setVisible(false);
...@@ -69,7 +71,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -69,7 +71,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_REPLAY_PAUSE: { case BUTTON_REPLAY_PAUSE: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
if(!mainGame->dInfo.isReplay) if(!mainGame->dInfo.isReplay)
break; break;
mainGame->btnReplayStart->setVisible(true); mainGame->btnReplayStart->setVisible(true);
...@@ -80,21 +83,24 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -80,21 +83,24 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_REPLAY_STEP: { case BUTTON_REPLAY_STEP: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
if(!mainGame->dInfo.isReplay) if(!mainGame->dInfo.isReplay)
break; break;
ReplayMode::Pause(false, true); ReplayMode::Pause(false, true);
break; break;
} }
case BUTTON_REPLAY_EXIT: { case BUTTON_REPLAY_EXIT: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
if(!mainGame->dInfo.isReplay) if(!mainGame->dInfo.isReplay)
break; break;
ReplayMode::StopReplay(); ReplayMode::StopReplay();
break; break;
} }
case BUTTON_REPLAY_SWAP: { case BUTTON_REPLAY_SWAP: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::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)
...@@ -102,14 +108,16 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -102,14 +108,16 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_REPLAY_UNDO: { case BUTTON_REPLAY_UNDO: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
if(!mainGame->dInfo.isReplay) if(!mainGame->dInfo.isReplay)
break; break;
ReplayMode::Undo(); ReplayMode::Undo();
break; break;
} }
case BUTTON_REPLAY_SAVE: { case BUTTON_REPLAY_SAVE: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
if(mainGame->ebRSName->getText()[0] == 0) if(mainGame->ebRSName->getText()[0] == 0)
break; break;
mainGame->actionParam = 1; mainGame->actionParam = 1;
...@@ -118,14 +126,16 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -118,14 +126,16 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_REPLAY_CANCEL: { case BUTTON_REPLAY_CANCEL: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::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->soundEffectPlayer->doPlayerExit(); //mainGame->soundEffectPlayer->doPlayerExit();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::EQUIP);
if(mainGame->dInfo.isSingleMode) { if(mainGame->dInfo.isSingleMode) {
mainGame->singleSignal.SetNoWait(true); mainGame->singleSignal.SetNoWait(true);
SingleMode::StopPlay(false); SingleMode::StopPlay(false);
...@@ -160,18 +170,21 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -160,18 +170,21 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_SURRENDER_YES: { case BUTTON_SURRENDER_YES: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
DuelClient::SendPacketToServer(CTOS_SURRENDER); DuelClient::SendPacketToServer(CTOS_SURRENDER);
mainGame->HideElement(mainGame->wSurrender); mainGame->HideElement(mainGame->wSurrender);
break; break;
} }
case BUTTON_SURRENDER_NO: { case BUTTON_SURRENDER_NO: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
mainGame->HideElement(mainGame->wSurrender); mainGame->HideElement(mainGame->wSurrender);
break; break;
} }
case BUTTON_CHAIN_IGNORE: { case BUTTON_CHAIN_IGNORE: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::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;
...@@ -179,7 +192,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -179,7 +192,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_CHAIN_ALWAYS: { case BUTTON_CHAIN_ALWAYS: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::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;
...@@ -187,7 +201,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -187,7 +201,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_CHAIN_WHENAVAIL: { case BUTTON_CHAIN_WHENAVAIL: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::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;
...@@ -195,18 +210,21 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -195,18 +210,21 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_CANCEL_OR_FINISH: { case BUTTON_CANCEL_OR_FINISH: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
CancelOrFinish(); CancelOrFinish();
break; break;
} }
case BUTTON_MSG_OK: { case BUTTON_MSG_OK: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
mainGame->HideElement(mainGame->wMessage); mainGame->HideElement(mainGame->wMessage);
mainGame->actionSignal.Set(); mainGame->actionSignal.Set();
break; break;
} }
case BUTTON_YES: { case BUTTON_YES: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::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: {
...@@ -240,7 +258,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -240,7 +258,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_NO: { case BUTTON_NO: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::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: {
...@@ -273,31 +292,36 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -273,31 +292,36 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_POS_AU: { case BUTTON_POS_AU: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
DuelClient::SetResponseI(POS_FACEUP_ATTACK); DuelClient::SetResponseI(POS_FACEUP_ATTACK);
mainGame->HideElement(mainGame->wPosSelect, true); mainGame->HideElement(mainGame->wPosSelect, true);
break; break;
} }
case BUTTON_POS_AD: { case BUTTON_POS_AD: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
DuelClient::SetResponseI(POS_FACEDOWN_ATTACK); DuelClient::SetResponseI(POS_FACEDOWN_ATTACK);
mainGame->HideElement(mainGame->wPosSelect, true); mainGame->HideElement(mainGame->wPosSelect, true);
break; break;
} }
case BUTTON_POS_DU: { case BUTTON_POS_DU: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
DuelClient::SetResponseI(POS_FACEUP_DEFENSE); DuelClient::SetResponseI(POS_FACEUP_DEFENSE);
mainGame->HideElement(mainGame->wPosSelect, true); mainGame->HideElement(mainGame->wPosSelect, true);
break; break;
} }
case BUTTON_POS_DD: { case BUTTON_POS_DD: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
DuelClient::SetResponseI(POS_FACEDOWN_DEFENSE); DuelClient::SetResponseI(POS_FACEDOWN_DEFENSE);
mainGame->HideElement(mainGame->wPosSelect, true); mainGame->HideElement(mainGame->wPosSelect, true);
break; break;
} }
case BUTTON_OPTION_PREV: { case BUTTON_OPTION_PREV: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
selected_option--; selected_option--;
mainGame->btnOptionn->setVisible(true); mainGame->btnOptionn->setVisible(true);
if(selected_option == 0) if(selected_option == 0)
...@@ -306,7 +330,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -306,7 +330,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_OPTION_NEXT: { case BUTTON_OPTION_NEXT: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::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)
...@@ -319,25 +344,29 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -319,25 +344,29 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case BUTTON_OPTION_2: case BUTTON_OPTION_2:
case BUTTON_OPTION_3: case BUTTON_OPTION_3:
case BUTTON_OPTION_4: { 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; int step = mainGame->scrOption->isVisible() ? mainGame->scrOption->getPos() : 0;
selected_option = id - BUTTON_OPTION_0 + step; selected_option = id - BUTTON_OPTION_0 + step;
SetResponseSelectedOption(); SetResponseSelectedOption();
break; break;
} }
case BUTTON_OPTION_OK: { case BUTTON_OPTION_OK: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
SetResponseSelectedOption(); SetResponseSelectedOption();
break; break;
} }
case BUTTON_ANNUMBER_OK: { case BUTTON_ANNUMBER_OK: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::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->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
int sel = mainGame->lstANCard->getSelected(); int sel = mainGame->lstANCard->getSelected();
if(sel == -1) if(sel == -1)
break; break;
...@@ -346,7 +375,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -346,7 +375,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_CMD_SHUFFLE: { case BUTTON_CMD_SHUFFLE: {
mainGame->soundEffectPlayer->doShuffleCardEffect(); //mainGame->soundEffectPlayer->doShuffleCardEffect();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::SHUFFLE);
mainGame->btnShuffle->setVisible(false); mainGame->btnShuffle->setVisible(false);
DuelClient::SetResponseI(8); DuelClient::SetResponseI(8);
DuelClient::SendResponse(); DuelClient::SendResponse();
...@@ -544,7 +574,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -544,7 +574,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_CMD_SHOWLIST: { case BUTTON_CMD_SHOWLIST: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
mainGame->wCmdMenu->setVisible(false); mainGame->wCmdMenu->setVisible(false);
selectable_cards.clear(); selectable_cards.clear();
wchar_t formatBuffer[2048]; wchar_t formatBuffer[2048];
...@@ -772,7 +803,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -772,7 +803,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_CARD_SEL_OK: { case BUTTON_CARD_SEL_OK: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
mainGame->stCardListTip->setVisible(false); mainGame->stCardListTip->setVisible(false);
if(mainGame->dInfo.isReplay) { if(mainGame->dInfo.isReplay) {
mainGame->HideElement(mainGame->wCardSelect); mainGame->HideElement(mainGame->wCardSelect);
...@@ -802,7 +834,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -802,7 +834,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_CARD_DISP_OK: { case BUTTON_CARD_DISP_OK: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
mainGame->HideElement(mainGame->wCardDisplay); mainGame->HideElement(mainGame->wCardDisplay);
break; break;
} }
......
...@@ -81,8 +81,8 @@ bool Game::Initialize() { ...@@ -81,8 +81,8 @@ bool Game::Initialize() {
setPositionFix(appPosition); setPositionFix(appPosition);
device->setProcessReceiver(this); device->setProcessReceiver(this);
soundEffectPlayer = new AndroidSoundEffectPlayer(app); //soundEffectPlayer = new AndroidSoundEffectPlayer(app);
soundEffectPlayer->setSEEnabled(options->isSoundEffectEnabled()); //soundEffectPlayer->setSEEnabled(options->isSoundEffectEnabled());
app->onInputEvent = android::handleInput; app->onInputEvent = android::handleInput;
ILogger* logger = device->getLogger(); ILogger* logger = device->getLogger();
// logger->setLogLevel(ELL_WARNING); // logger->setLogLevel(ELL_WARNING);
...@@ -433,7 +433,7 @@ bool Game::Initialize() { ...@@ -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 = env->addScrollBar(true, rect<s32>(posX + 110 * xScale, posY, posX + 250 * xScale, posY + 30 * yScale), tabHelper, SCROLL_VOLUME);
scrSoundVolume->setMax(100); scrSoundVolume->setMax(100);
scrSoundVolume->setMin(0); scrSoundVolume->setMin(0);
scrSoundVolume->setPos(gameConf.sound_volume * 100); scrSoundVolume->setPos(gameConf.sound_volume);
scrSoundVolume->setLargeStep(1); scrSoundVolume->setLargeStep(1);
scrSoundVolume->setSmallStep(1); scrSoundVolume->setSmallStep(1);
posY += 60; posY += 60;
...@@ -442,7 +442,7 @@ bool Game::Initialize() { ...@@ -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 = env->addScrollBar(true, rect<s32>(posX + 110 * xScale, posY, posX + 250 * xScale, posY + 30 * yScale), tabHelper, SCROLL_VOLUME);
scrMusicVolume->setMax(100); scrMusicVolume->setMax(100);
scrMusicVolume->setMin(0); scrMusicVolume->setMin(0);
scrMusicVolume->setPos(gameConf.music_volume * 100); scrMusicVolume->setPos(gameConf.music_volume);
scrMusicVolume->setLargeStep(1); scrMusicVolume->setLargeStep(1);
scrMusicVolume->setSmallStep(1); scrMusicVolume->setSmallStep(1);
elmTabHelperLast = chkEnableMusic; elmTabHelperLast = chkEnableMusic;
...@@ -959,7 +959,7 @@ bool Game::Initialize() { ...@@ -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 = env->addButton(rect<s32>(205 * xScale, 220 * yScale, 305 * xScale, 275 * yScale), 0, BUTTON_CANCEL_OR_FINISH, dataManager.GetSysString(1295));
btnCancelOrFinish->setVisible(false); btnCancelOrFinish->setVisible(false);
soundManager = Utils::make_unique<SoundManager>(); 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->setChecked(false);
chkEnableSound->setEnabled(false); chkEnableSound->setEnabled(false);
chkEnableSound->setVisible(false); chkEnableSound->setVisible(false);
...@@ -1226,7 +1226,7 @@ void Game::MainLoop() { ...@@ -1226,7 +1226,7 @@ void Game::MainLoop() {
usleep(500000); usleep(500000);
#endif #endif
SaveConfig(); SaveConfig();
delete soundEffectPlayer; //delete soundEffectPlayer;
usleep(500000); usleep(500000);
// device->drop(); // device->drop();
} }
...@@ -1526,10 +1526,10 @@ void Game::SaveConfig() { ...@@ -1526,10 +1526,10 @@ void Game::SaveConfig() {
gameConf.enable_music = chkEnableMusic->isChecked() ? 1 : 0; gameConf.enable_music = chkEnableMusic->isChecked() ? 1 : 0;
android::saveIntSetting(appMain, "enable_music", gameConf.enable_music); android::saveIntSetting(appMain, "enable_music", gameConf.enable_music);
//gameConf.sound_volume = gameConf.sound_volume = (double)scrSoundVolume->getPos();
// android::saveIntSetting(appMain, "sound_volume", gameConf.sound_volume); android::saveIntSetting(appMain, "sound_volume", gameConf.sound_volume);
//gameConf.music_volume = gameConf.music_volume = (double)scrMusicVolume->getPos();
// android::saveIntSetting(appMain, "music_volume", gameConf.music_volume); android::saveIntSetting(appMain, "music_volume", gameConf.music_volume);
//gameConf.control_mode = control_mode->isChecked()?1:0; //gameConf.control_mode = control_mode->isChecked()?1:0;
// android::saveIntSetting(appMain, "control_mode", gameConf.control_mode); // android::saveIntSetting(appMain, "control_mode", gameConf.control_mode);
...@@ -1638,10 +1638,12 @@ void Game::AddChatMsg(const wchar_t* msg, int player) { ...@@ -1638,10 +1638,12 @@ void Game::AddChatMsg(const wchar_t* msg, int player) {
chatType[0] = player; chatType[0] = player;
switch(player) { switch(player) {
case 0: //from host case 0: //from host
soundManager->PlaySoundEffect(SoundManager::SFX::CHAT);
chatMsg[0].append(dInfo.hostname); chatMsg[0].append(dInfo.hostname);
chatMsg[0].append(L": "); chatMsg[0].append(L": ");
break; break;
case 1: //from client case 1: //from client
soundManager->PlaySoundEffect(SoundManager::SFX::CHAT);
chatMsg[0].append(dInfo.clientname); chatMsg[0].append(dInfo.clientname);
chatMsg[0].append(L": "); chatMsg[0].append(L": ");
break; break;
...@@ -1650,6 +1652,7 @@ void Game::AddChatMsg(const wchar_t* msg, int player) { ...@@ -1650,6 +1652,7 @@ void Game::AddChatMsg(const wchar_t* msg, int player) {
chatMsg[0].append(L": "); chatMsg[0].append(L": ");
break; break;
case 3: //client tag case 3: //client tag
soundManager->PlaySoundEffect(SoundManager::SFX::CHAT);
chatMsg[0].append(dInfo.clientname_tag); chatMsg[0].append(dInfo.clientname_tag);
chatMsg[0].append(L": "); chatMsg[0].append(L": ");
break; break;
...@@ -1658,6 +1661,7 @@ void Game::AddChatMsg(const wchar_t* msg, int player) { ...@@ -1658,6 +1661,7 @@ void Game::AddChatMsg(const 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.
soundManager->PlaySoundEffect(SoundManager::SFX::CHAT);
chatMsg[0].append(L"[System]: "); chatMsg[0].append(L"[System]: ");
break; break;
case 9: //error message case 9: //error message
......
...@@ -55,15 +55,19 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -55,15 +55,19 @@ 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)
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::INFO);
else
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::BUTTON);
switch(id) { switch(id) {
case BUTTON_MODE_EXIT: { case BUTTON_MODE_EXIT: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->SaveConfig(); mainGame->SaveConfig();
mainGame->device->closeDevice(); mainGame->device->closeDevice();
break; break;
} }
case BUTTON_LAN_MODE: { case BUTTON_LAN_MODE: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->btnCreateHost->setEnabled(true); mainGame->btnCreateHost->setEnabled(true);
mainGame->btnJoinHost->setEnabled(true); mainGame->btnJoinHost->setEnabled(true);
mainGame->btnJoinCancel->setEnabled(true); mainGame->btnJoinCancel->setEnabled(true);
...@@ -92,6 +96,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -92,6 +96,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
int status = evutil_getaddrinfo(hostname, port, &hints, &answer); int status = evutil_getaddrinfo(hostname, port, &hints, &answer);
if(status != 0) { if(status != 0) {
mainGame->gMutex.lock(); mainGame->gMutex.lock();
mainGame->soundManager->PlaySoundEffect(SoundManager::SFX::INFO);
mainGame->env->addMessageBox(L"", dataManager.GetSysString(1412)); mainGame->env->addMessageBox(L"", dataManager.GetSysString(1412));
mainGame->gMutex.unlock(); mainGame->gMutex.unlock();
break; break;
...@@ -112,7 +117,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -112,7 +117,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_JOIN_CANCEL: { case BUTTON_JOIN_CANCEL: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->HideElement(mainGame->wLanWindow); mainGame->HideElement(mainGame->wLanWindow);
mainGame->ShowElement(mainGame->wMainMenu); mainGame->ShowElement(mainGame->wMainMenu);
if(exit_on_return) if(exit_on_return)
...@@ -120,12 +125,12 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -120,12 +125,12 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_LAN_REFRESH: { case BUTTON_LAN_REFRESH: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
DuelClient::BeginRefreshHost(); DuelClient::BeginRefreshHost();
break; break;
} }
case BUTTON_CREATE_HOST: { case BUTTON_CREATE_HOST: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->btnHostConfirm->setEnabled(true); mainGame->btnHostConfirm->setEnabled(true);
mainGame->btnHostCancel->setEnabled(true); mainGame->btnHostCancel->setEnabled(true);
mainGame->HideElement(mainGame->wLanWindow); mainGame->HideElement(mainGame->wLanWindow);
...@@ -133,7 +138,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -133,7 +138,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_HOST_CONFIRM: { case BUTTON_HOST_CONFIRM: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
bot_mode = false; bot_mode = false;
BufferIO::CopyWStr(mainGame->ebServerName->getText(), mainGame->gameConf.gamename, 20); BufferIO::CopyWStr(mainGame->ebServerName->getText(), mainGame->gameConf.gamename, 20);
if(!NetServer::StartServer(mainGame->gameConf.serverport)) if(!NetServer::StartServer(mainGame->gameConf.serverport))
...@@ -147,7 +152,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -147,7 +152,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_HOST_CANCEL: { case BUTTON_HOST_CANCEL: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->btnCreateHost->setEnabled(true); mainGame->btnCreateHost->setEnabled(true);
mainGame->btnJoinHost->setEnabled(true); mainGame->btnJoinHost->setEnabled(true);
mainGame->btnJoinCancel->setEnabled(true); mainGame->btnJoinCancel->setEnabled(true);
...@@ -156,18 +161,18 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -156,18 +161,18 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_HP_DUELIST: { case BUTTON_HP_DUELIST: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->cbDeckSelect->setEnabled(true); mainGame->cbDeckSelect->setEnabled(true);
DuelClient::SendPacketToServer(CTOS_HS_TODUELIST); DuelClient::SendPacketToServer(CTOS_HS_TODUELIST);
break; break;
} }
case BUTTON_HP_OBSERVER: { case BUTTON_HP_OBSERVER: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
DuelClient::SendPacketToServer(CTOS_HS_TOOBSERVER); DuelClient::SendPacketToServer(CTOS_HS_TOOBSERVER);
break; break;
} }
case BUTTON_HP_KICK: { case BUTTON_HP_KICK: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
int id = 0; int id = 0;
while(id < 4) { while(id < 4) {
if(mainGame->btnHostPrepKick[id] == caller) if(mainGame->btnHostPrepKick[id] == caller)
...@@ -180,7 +185,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -180,7 +185,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_HP_READY: { case BUTTON_HP_READY: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
if(mainGame->cbCategorySelect->getSelected() == -1 || mainGame->cbDeckSelect->getSelected() == -1 || if(mainGame->cbCategorySelect->getSelected() == -1 || mainGame->cbDeckSelect->getSelected() == -1 ||
!deckManager.LoadDeck(mainGame->cbCategorySelect, mainGame->cbDeckSelect)) { !deckManager.LoadDeck(mainGame->cbCategorySelect, mainGame->cbDeckSelect)) {
break; break;
...@@ -192,19 +197,19 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -192,19 +197,19 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_HP_NOTREADY: { case BUTTON_HP_NOTREADY: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
DuelClient::SendPacketToServer(CTOS_HS_NOTREADY); DuelClient::SendPacketToServer(CTOS_HS_NOTREADY);
mainGame->cbCategorySelect->setEnabled(true); mainGame->cbCategorySelect->setEnabled(true);
mainGame->cbDeckSelect->setEnabled(true); mainGame->cbDeckSelect->setEnabled(true);
break; break;
} }
case BUTTON_HP_START: { case BUTTON_HP_START: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
DuelClient::SendPacketToServer(CTOS_HS_START); DuelClient::SendPacketToServer(CTOS_HS_START);
break; break;
} }
case BUTTON_HP_CANCEL: { case BUTTON_HP_CANCEL: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
DuelClient::StopClient(); DuelClient::StopClient();
mainGame->btnCreateHost->setEnabled(true); mainGame->btnCreateHost->setEnabled(true);
mainGame->btnJoinHost->setEnabled(true); mainGame->btnJoinHost->setEnabled(true);
...@@ -223,7 +228,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -223,7 +228,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_REPLAY_MODE: { case BUTTON_REPLAY_MODE: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->HideElement(mainGame->wMainMenu); mainGame->HideElement(mainGame->wMainMenu);
mainGame->ShowElement(mainGame->wReplay); mainGame->ShowElement(mainGame->wReplay);
mainGame->ebRepStartTurn->setText(L"1"); mainGame->ebRepStartTurn->setText(L"1");
...@@ -232,7 +237,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -232,7 +237,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_SINGLE_MODE: { case BUTTON_SINGLE_MODE: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->HideElement(mainGame->wMainMenu); mainGame->HideElement(mainGame->wMainMenu);
mainGame->ShowElement(mainGame->wSinglePlay); mainGame->ShowElement(mainGame->wSinglePlay);
mainGame->RefreshSingleplay(); mainGame->RefreshSingleplay();
...@@ -240,7 +245,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -240,7 +245,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_LOAD_REPLAY: { case BUTTON_LOAD_REPLAY: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
if(mainGame->lstReplayList->getSelected() == -1) if(mainGame->lstReplayList->getSelected() == -1)
break; break;
if(!ReplayMode::cur_replay.OpenReplay(mainGame->lstReplayList->getListItem(mainGame->lstReplayList->getSelected()))) if(!ReplayMode::cur_replay.OpenReplay(mainGame->lstReplayList->getListItem(mainGame->lstReplayList->getSelected())))
...@@ -293,7 +298,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -293,7 +298,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_CANCEL_REPLAY: { case BUTTON_CANCEL_REPLAY: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->HideElement(mainGame->wReplay); mainGame->HideElement(mainGame->wReplay);
mainGame->ShowElement(mainGame->wMainMenu); mainGame->ShowElement(mainGame->wMainMenu);
break; break;
...@@ -406,7 +411,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -406,7 +411,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_LOAD_SINGLEPLAY: { case BUTTON_LOAD_SINGLEPLAY: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
if(mainGame->lstSinglePlayList->getSelected() == -1) if(mainGame->lstSinglePlayList->getSelected() == -1)
break; break;
mainGame->singleSignal.SetNoWait(false); mainGame->singleSignal.SetNoWait(false);
...@@ -414,14 +419,14 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -414,14 +419,14 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_CANCEL_SINGLEPLAY: { case BUTTON_CANCEL_SINGLEPLAY: {
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
mainGame->HideElement(mainGame->wSinglePlay); mainGame->HideElement(mainGame->wSinglePlay);
mainGame->ShowElement(mainGame->wMainMenu); mainGame->ShowElement(mainGame->wMainMenu);
break; break;
} }
case BUTTON_DECK_EDIT: { case BUTTON_DECK_EDIT: {
mainGame->RefreshCategoryDeck(mainGame->cbDBCategory, mainGame->cbDBDecks); mainGame->RefreshCategoryDeck(mainGame->cbDBCategory, mainGame->cbDBDecks);
mainGame->soundEffectPlayer->doPressButton(); //mainGame->soundEffectPlayer->doPressButton();
if(mainGame->cbDBCategory->getSelected() != -1 && mainGame->cbDBDecks->getSelected() != -1) { if(mainGame->cbDBCategory->getSelected() != -1 && mainGame->cbDBDecks->getSelected() != -1) {
deckManager.LoadDeck(mainGame->cbDBCategory, mainGame->cbDBDecks); deckManager.LoadDeck(mainGame->cbDBCategory, mainGame->cbDBDecks);
mainGame->ebDeckname->setText(L""); mainGame->ebDeckname->setText(L"");
......
#include "sound_manager.h" #include "sound_manager.h"
#include "config.h" #include "config.h"
#include "game.h"
namespace ygo { namespace ygo {
...@@ -80,12 +81,40 @@ void SoundManager::PlaySoundEffect(SFX sound) { ...@@ -80,12 +81,40 @@ void SoundManager::PlaySoundEffect(SFX sound) {
{DICE, "./sound/diceroll.wav"}, {DICE, "./sound/diceroll.wav"},
{NEXT_TURN, "./sound/nextturn.wav"}, {NEXT_TURN, "./sound/nextturn.wav"},
{PHASE, "./sound/phase.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"}, {PLAYER_ENTER, "./sound/playerenter.wav"},
{CHAT, "./sound/chatmessage.wav"} {CHAT, "./sound/chatmessage.wav"}
}; };
if (!soundsEnabled) return; if (!soundsEnabled) return;
if (sfx) sfx->play(fx.at(sound), false); 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) { void SoundManager::PlayMusic(const std::string& song, bool loop) {
if(!musicEnabled) return; if(!musicEnabled) return;
StopBGM(); StopBGM();
...@@ -98,7 +127,7 @@ void SoundManager::PlayBGM(BGM scene) { ...@@ -98,7 +127,7 @@ void SoundManager::PlayBGM(BGM scene) {
bgm_scene = scene; bgm_scene = scene;
int bgm = (std::uniform_int_distribution<>(0, count - 1))(rnd); int bgm = (std::uniform_int_distribution<>(0, count - 1))(rnd);
std::string BGMName = "./sound/BGM/" + list[bgm]; std::string BGMName = "./sound/BGM/" + list[bgm];
PlayMusic(BGMName, true); PlayMusic(BGMName, false);
} }
} }
void SoundManager::StopBGM() { void SoundManager::StopBGM() {
......
...@@ -32,6 +32,11 @@ public: ...@@ -32,6 +32,11 @@ public:
DICE, DICE,
NEXT_TURN, NEXT_TURN,
PHASE, PHASE,
BUTTON,
INFO,
QUESTION,
CARD_PICK,
CARD_DROP,
PLAYER_ENTER, PLAYER_ENTER,
CHAT CHAT
}; };
...@@ -48,6 +53,7 @@ public: ...@@ -48,6 +53,7 @@ public:
bool Init(double sounds_volume, double music_volume, bool sounds_enabled, bool music_enabled, void* payload = nullptr); bool Init(double sounds_volume, double music_volume, bool sounds_enabled, bool music_enabled, void* payload = nullptr);
void RefreshBGMList(); void RefreshBGMList();
void PlaySoundEffect(SFX sound); void PlaySoundEffect(SFX sound);
void PlayDialogSound(irr::gui::IGUIElement * element);
void PlayMusic(const std::string& song, bool loop); void PlayMusic(const std::string& song, bool loop);
void PlayBGM(BGM scene); void PlayBGM(BGM scene);
void StopBGM(); void StopBGM();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment