Commit d8378afb authored by mercury233's avatar mercury233

update sounds

parent 092621e0
...@@ -1011,6 +1011,7 @@ bool ClientField::ShowSelectSum(bool panelmode) { ...@@ -1011,6 +1011,7 @@ bool ClientField::ShowSelectSum(bool panelmode) {
BufferIO::CopyWStrRef(dataManager.GetSysString(210), pwbuf, 256); BufferIO::CopyWStrRef(dataManager.GetSysString(210), pwbuf, 256);
mainGame->stQMessage->setText(wbuf); mainGame->stQMessage->setText(wbuf);
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
mainGame->PlaySoundEffect(SOUND_QUESTION);
} }
} else { } else {
select_ready = false; select_ready = false;
...@@ -1032,6 +1033,7 @@ bool ClientField::ShowSelectSum(bool panelmode) { ...@@ -1032,6 +1033,7 @@ bool ClientField::ShowSelectSum(bool panelmode) {
BufferIO::CopyWStrRef(dataManager.GetSysString(210), pwbuf, 256); BufferIO::CopyWStrRef(dataManager.GetSysString(210), pwbuf, 256);
mainGame->stQMessage->setText(wbuf); mainGame->stQMessage->setText(wbuf);
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
mainGame->PlaySoundEffect(SOUND_QUESTION);
} }
} else } else
select_ready = false; select_ready = false;
......
...@@ -118,11 +118,13 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -118,11 +118,13 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
break; break;
switch(event.GUIEvent.EventType) { switch(event.GUIEvent.EventType) {
case irr::gui::EGET_BUTTON_CLICKED: { case irr::gui::EGET_BUTTON_CLICKED: {
mainGame->PlaySoundEffect(SOUND_BUTTON);
switch(id) { switch(id) {
case BUTTON_CLEAR_DECK: { case BUTTON_CLEAR_DECK: {
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, (wchar_t*)dataManager.GetSysString(1339)); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, (wchar_t*)dataManager.GetSysString(1339));
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
mainGame->PlaySoundEffect(SOUND_QUESTION);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
prev_operation = id; prev_operation = id;
break; break;
...@@ -179,6 +181,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -179,6 +181,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
myswprintf(textBuffer, L"%ls\n%ls", mainGame->cbDBDecks->getItem(sel), dataManager.GetSysString(1337)); myswprintf(textBuffer, L"%ls\n%ls", mainGame->cbDBDecks->getItem(sel), dataManager.GetSysString(1337));
mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, (wchar_t*)textBuffer); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, (wchar_t*)textBuffer);
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
mainGame->PlaySoundEffect(SOUND_QUESTION);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
prev_operation = id; prev_operation = id;
break; break;
...@@ -188,6 +191,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -188,6 +191,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, (wchar_t*)dataManager.GetSysString(1356)); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, (wchar_t*)dataManager.GetSysString(1356));
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
mainGame->PlaySoundEffect(SOUND_QUESTION);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
prev_operation = id; prev_operation = id;
break; break;
...@@ -345,6 +349,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -345,6 +349,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, (wchar_t*)dataManager.GetSysString(1356)); mainGame->SetStaticText(mainGame->stQMessage, 310, mainGame->textFont, (wchar_t*)dataManager.GetSysString(1356));
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
mainGame->PlaySoundEffect(SOUND_QUESTION);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
prev_operation = id; prev_operation = id;
break; break;
...@@ -496,6 +501,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -496,6 +501,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
is_starting_dragging = false; is_starting_dragging = false;
if(!is_draging) if(!is_draging)
break; break;
mainGame->PlaySoundEffect(SOUND_CARD_DROP);
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);
...@@ -525,6 +531,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -525,6 +531,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
auto pointer = dataManager.GetCodePointer(hovered_code); auto pointer = dataManager.GetCodePointer(hovered_code);
if(pointer == dataManager._datas.end()) if(pointer == dataManager._datas.end())
break; break;
mainGame->PlaySoundEffect(SOUND_CARD_DROP);
if(hovered_pos == 1) { if(hovered_pos == 1) {
if(push_side(pointer)) if(push_side(pointer))
pop_main(hovered_seq); pop_main(hovered_seq);
...@@ -542,6 +549,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -542,6 +549,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
if(!is_draging) { if(!is_draging) {
if(hovered_pos == 0 || hovered_seq == -1) if(hovered_pos == 0 || hovered_seq == -1)
break; break;
mainGame->PlaySoundEffect(SOUND_CARD_DROP);
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) {
...@@ -558,6 +566,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -558,6 +566,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
push_side(pointer); push_side(pointer);
} }
} else { } else {
mainGame->PlaySoundEffect(SOUND_CARD_PICK);
if(click_pos == 1) { if(click_pos == 1) {
push_side(draging_pointer); push_side(draging_pointer);
} else if(click_pos == 2) { } else if(click_pos == 2) {
...@@ -584,6 +593,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -584,6 +593,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
auto pointer = dataManager.GetCodePointer(hovered_code); auto pointer = dataManager.GetCodePointer(hovered_code);
if(!check_limit(pointer)) if(!check_limit(pointer))
break; break;
mainGame->PlaySoundEffect(SOUND_CARD_PICK);
if (hovered_pos == 1) { if (hovered_pos == 1) {
if(!push_main(pointer)) if(!push_main(pointer))
push_side(pointer); push_side(pointer);
...@@ -602,6 +612,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -602,6 +612,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
case irr::EMIE_MOUSE_MOVED: { case irr::EMIE_MOUSE_MOVED: {
if(is_starting_dragging) { if(is_starting_dragging) {
is_draging = true; is_draging = true;
mainGame->PlaySoundEffect(SOUND_CARD_PICK);
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)
......
This diff is collapsed.
...@@ -40,6 +40,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -40,6 +40,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
} }
case BUTTON_FIRST: case BUTTON_FIRST:
case BUTTON_SECOND: { case BUTTON_SECOND: {
mainGame->PlaySoundEffect(SOUND_BUTTON);
mainGame->HideElement(mainGame->wFTSelect); mainGame->HideElement(mainGame->wFTSelect);
CTOS_TPResult cstr; CTOS_TPResult cstr;
cstr.res = BUTTON_SECOND - id; cstr.res = BUTTON_SECOND - id;
...@@ -49,6 +50,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -49,6 +50,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case BUTTON_REPLAY_START: { case BUTTON_REPLAY_START: {
if(!mainGame->dInfo.isReplay) if(!mainGame->dInfo.isReplay)
break; break;
mainGame->PlaySoundEffect(SOUND_BUTTON);
mainGame->btnReplayStart->setVisible(false); mainGame->btnReplayStart->setVisible(false);
mainGame->btnReplayPause->setVisible(true); mainGame->btnReplayPause->setVisible(true);
mainGame->btnReplayStep->setVisible(false); mainGame->btnReplayStep->setVisible(false);
...@@ -59,6 +61,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -59,6 +61,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case BUTTON_REPLAY_PAUSE: { case BUTTON_REPLAY_PAUSE: {
if(!mainGame->dInfo.isReplay) if(!mainGame->dInfo.isReplay)
break; break;
mainGame->PlaySoundEffect(SOUND_BUTTON);
mainGame->btnReplayStart->setVisible(true); mainGame->btnReplayStart->setVisible(true);
mainGame->btnReplayPause->setVisible(false); mainGame->btnReplayPause->setVisible(false);
mainGame->btnReplayStep->setVisible(true); mainGame->btnReplayStep->setVisible(true);
...@@ -69,16 +72,19 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -69,16 +72,19 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case BUTTON_REPLAY_STEP: { case BUTTON_REPLAY_STEP: {
if(!mainGame->dInfo.isReplay) if(!mainGame->dInfo.isReplay)
break; break;
mainGame->PlaySoundEffect(SOUND_BUTTON);
ReplayMode::Pause(false, true); ReplayMode::Pause(false, true);
break; break;
} }
case BUTTON_REPLAY_EXIT: { case BUTTON_REPLAY_EXIT: {
if(!mainGame->dInfo.isReplay) if(!mainGame->dInfo.isReplay)
break; break;
mainGame->PlaySoundEffect(SOUND_BUTTON);
ReplayMode::StopReplay(); ReplayMode::StopReplay();
break; break;
} }
case BUTTON_REPLAY_SWAP: { case BUTTON_REPLAY_SWAP: {
mainGame->PlaySoundEffect(SOUND_BUTTON);
if(mainGame->dInfo.isReplay) if(mainGame->dInfo.isReplay)
ReplayMode::SwapField(); ReplayMode::SwapField();
else if (mainGame->dInfo.player_type == 7) else if (mainGame->dInfo.player_type == 7)
...@@ -88,24 +94,28 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -88,24 +94,28 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case BUTTON_REPLAY_UNDO: { case BUTTON_REPLAY_UNDO: {
if(!mainGame->dInfo.isReplay) if(!mainGame->dInfo.isReplay)
break; break;
mainGame->PlaySoundEffect(SOUND_BUTTON);
ReplayMode::Undo(); ReplayMode::Undo();
break; break;
} }
case BUTTON_REPLAY_SAVE: { case BUTTON_REPLAY_SAVE: {
if(mainGame->ebRSName->getText()[0] == 0) if(mainGame->ebRSName->getText()[0] == 0)
break; break;
mainGame->PlaySoundEffect(SOUND_BUTTON);
mainGame->actionParam = 1; mainGame->actionParam = 1;
mainGame->HideElement(mainGame->wReplaySave); mainGame->HideElement(mainGame->wReplaySave);
mainGame->replaySignal.Set(); mainGame->replaySignal.Set();
break; break;
} }
case BUTTON_REPLAY_CANCEL: { case BUTTON_REPLAY_CANCEL: {
mainGame->PlaySoundEffect(SOUND_BUTTON);
mainGame->actionParam = 0; mainGame->actionParam = 0;
mainGame->HideElement(mainGame->wReplaySave); mainGame->HideElement(mainGame->wReplaySave);
mainGame->replaySignal.Set(); mainGame->replaySignal.Set();
break; break;
} }
case BUTTON_LEAVE_GAME: { case BUTTON_LEAVE_GAME: {
mainGame->PlaySoundEffect(SOUND_BUTTON);
if(mainGame->dInfo.isSingleMode) { if(mainGame->dInfo.isSingleMode) {
mainGame->singleSignal.SetNoWait(true); mainGame->singleSignal.SetNoWait(true);
SingleMode::StopPlay(false); SingleMode::StopPlay(false);
...@@ -131,6 +141,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -131,6 +141,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_CHAIN_IGNORE: { case BUTTON_CHAIN_IGNORE: {
mainGame->PlaySoundEffect(SOUND_BUTTON);
mainGame->ignore_chain = mainGame->btnChainIgnore->isPressed(); mainGame->ignore_chain = mainGame->btnChainIgnore->isPressed();
mainGame->always_chain = false; mainGame->always_chain = false;
mainGame->chain_when_avail = false; mainGame->chain_when_avail = false;
...@@ -138,6 +149,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -138,6 +149,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_CHAIN_ALWAYS: { case BUTTON_CHAIN_ALWAYS: {
mainGame->PlaySoundEffect(SOUND_BUTTON);
mainGame->always_chain = mainGame->btnChainAlways->isPressed(); mainGame->always_chain = mainGame->btnChainAlways->isPressed();
mainGame->ignore_chain = false; mainGame->ignore_chain = false;
mainGame->chain_when_avail = false; mainGame->chain_when_avail = false;
...@@ -145,6 +157,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -145,6 +157,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_CHAIN_WHENAVAIL: { case BUTTON_CHAIN_WHENAVAIL: {
mainGame->PlaySoundEffect(SOUND_BUTTON);
mainGame->chain_when_avail = mainGame->btnChainWhenAvail->isPressed(); mainGame->chain_when_avail = mainGame->btnChainWhenAvail->isPressed();
mainGame->always_chain = false; mainGame->always_chain = false;
mainGame->ignore_chain = false; mainGame->ignore_chain = false;
...@@ -152,6 +165,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -152,6 +165,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_CANCEL_OR_FINISH: { case BUTTON_CANCEL_OR_FINISH: {
mainGame->PlaySoundEffect(SOUND_BUTTON);
switch (mainGame->dInfo.curMsg) { switch (mainGame->dInfo.curMsg) {
case MSG_WAITING: { case MSG_WAITING: {
if (mainGame->wCardSelect->isVisible()) { if (mainGame->wCardSelect->isVisible()) {
...@@ -261,6 +275,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -261,6 +275,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
} }
else { else {
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
mainGame->PlaySoundEffect(SOUND_QUESTION);
ShowCancelOrFinishButton(0); ShowCancelOrFinishButton(0);
} }
if (mainGame->wOptions->isVisible()) { if (mainGame->wOptions->isVisible()) {
...@@ -282,11 +297,13 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -282,11 +297,13 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_MSG_OK: { case BUTTON_MSG_OK: {
mainGame->PlaySoundEffect(SOUND_BUTTON);
mainGame->HideElement(mainGame->wMessage); mainGame->HideElement(mainGame->wMessage);
mainGame->actionSignal.Set(); mainGame->actionSignal.Set();
break; break;
} }
case BUTTON_YES: { case BUTTON_YES: {
mainGame->PlaySoundEffect(SOUND_BUTTON);
switch(mainGame->dInfo.curMsg) { switch(mainGame->dInfo.curMsg) {
case MSG_SELECT_YESNO: case MSG_SELECT_YESNO:
case MSG_SELECT_EFFECTYN: { case MSG_SELECT_EFFECTYN: {
...@@ -320,6 +337,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -320,6 +337,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_NO: { case BUTTON_NO: {
mainGame->PlaySoundEffect(SOUND_BUTTON);
switch(mainGame->dInfo.curMsg) { switch(mainGame->dInfo.curMsg) {
case MSG_SELECT_YESNO: case MSG_SELECT_YESNO:
case MSG_SELECT_EFFECTYN: { case MSG_SELECT_EFFECTYN: {
...@@ -372,6 +390,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -372,6 +390,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_OPTION_PREV: { case BUTTON_OPTION_PREV: {
mainGame->PlaySoundEffect(SOUND_BUTTON);
selected_option--; selected_option--;
mainGame->btnOptionn->setVisible(true); mainGame->btnOptionn->setVisible(true);
if(selected_option == 0) if(selected_option == 0)
...@@ -380,6 +399,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -380,6 +399,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_OPTION_NEXT: { case BUTTON_OPTION_NEXT: {
mainGame->PlaySoundEffect(SOUND_BUTTON);
selected_option++; selected_option++;
mainGame->btnOptionp->setVisible(true); mainGame->btnOptionp->setVisible(true);
if(selected_option == select_options.size() - 1) if(selected_option == select_options.size() - 1)
...@@ -388,6 +408,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -388,6 +408,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_OPTION_OK: { case BUTTON_OPTION_OK: {
mainGame->PlaySoundEffect(SOUND_BUTTON);
if (mainGame->dInfo.curMsg == MSG_SELECT_OPTION) { if (mainGame->dInfo.curMsg == MSG_SELECT_OPTION) {
DuelClient::SetResponseI(selected_option); DuelClient::SetResponseI(selected_option);
} else { } else {
...@@ -405,11 +426,13 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -405,11 +426,13 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_ANNUMBER_OK: { case BUTTON_ANNUMBER_OK: {
mainGame->PlaySoundEffect(SOUND_BUTTON);
DuelClient::SetResponseI(mainGame->cbANNumber->getSelected()); DuelClient::SetResponseI(mainGame->cbANNumber->getSelected());
mainGame->HideElement(mainGame->wANNumber, true); mainGame->HideElement(mainGame->wANNumber, true);
break; break;
} }
case BUTTON_ANCARD_OK: { case BUTTON_ANCARD_OK: {
mainGame->PlaySoundEffect(SOUND_BUTTON);
int sel = mainGame->lstANCard->getSelected(); int sel = mainGame->lstANCard->getSelected();
if(sel == -1) if(sel == -1)
break; break;
...@@ -1426,6 +1449,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1426,6 +1449,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
BufferIO::CopyWStrRef(dataManager.GetSysString(210), pwbuf, 256); BufferIO::CopyWStrRef(dataManager.GetSysString(210), pwbuf, 256);
mainGame->stQMessage->setText(wbuf); mainGame->stQMessage->setText(wbuf);
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
mainGame->PlaySoundEffect(SOUND_QUESTION);
} }
} }
} else { } else {
...@@ -1601,6 +1625,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1601,6 +1625,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame->HideElement(mainGame->wQuery, true); mainGame->HideElement(mainGame->wQuery, true);
} else { } else {
mainGame->PopupElement(mainGame->wQuery); mainGame->PopupElement(mainGame->wQuery);
mainGame->PlaySoundEffect(SOUND_QUESTION);
ShowCancelOrFinishButton(0); ShowCancelOrFinishButton(0);
} }
if(mainGame->wOptions->isVisible()) { if(mainGame->wOptions->isVisible()) {
...@@ -1951,6 +1976,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) { ...@@ -1951,6 +1976,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
s32 id = event.GUIEvent.Caller->getID(); s32 id = event.GUIEvent.Caller->getID();
switch(event.GUIEvent.EventType) { switch(event.GUIEvent.EventType) {
case irr::gui::EGET_BUTTON_CLICKED: { case irr::gui::EGET_BUTTON_CLICKED: {
mainGame->PlaySoundEffect(SOUND_BUTTON);
switch(id) { switch(id) {
case BUTTON_CLEAR_LOG: { case BUTTON_CLEAR_LOG: {
mainGame->lstLog->clear(); mainGame->lstLog->clear();
......
...@@ -1136,11 +1136,130 @@ void Game::SaveConfig() { ...@@ -1136,11 +1136,130 @@ void Game::SaveConfig() {
fprintf(fp, "music_mode = %d\n", ((mainGame->chkMusicMode->isChecked()) ? 1 : 0)); fprintf(fp, "music_mode = %d\n", ((mainGame->chkMusicMode->isChecked()) ? 1 : 0));
fclose(fp); fclose(fp);
} }
void Game::PlaySoundEffect(char* sound) { void Game::PlaySoundEffect(int sound) {
if(mainGame->chkEnableSound->isChecked()) { if(!mainGame->chkEnableSound->isChecked())
engineSound->play2D(sound); return;
engineSound->setSoundVolume(gameConf.sound_volume); switch(sound) {
case SOUND_SUMMON: {
engineSound->play2D("./sound/summon.wav");
break;
}
case SOUND_SPECIAL_SUMMON: {
engineSound->play2D("./sound/specialsummon.wav");
break;
}
case SOUND_ACTIVATE: {
engineSound->play2D("./sound/activate.wav");
break;
}
case SOUND_SET: {
engineSound->play2D("./sound/set.wav");
break;
}
case SOUND_FILP: {
engineSound->play2D("./sound/flip.wav");
break;
}
case SOUND_REVEAL: {
engineSound->play2D("./sound/reveal.wav");
break;
}
case SOUND_EQUIP: {
engineSound->play2D("./sound/equip.wav");
break;
}
case SOUND_DESTROYED: {
engineSound->play2D("./sound/destroyed.wav");
break;
}
case SOUND_BANISHED: {
engineSound->play2D("./sound/banished.wav");
break;
}
case SOUND_ATTACK: {
engineSound->play2D("./sound/attack.wav");
break;
}
case SOUND_DIRECT_ATTACK: {
engineSound->play2D("./sound/directattack.wav");
break;
}
case SOUND_DRAW: {
engineSound->play2D("./sound/draw.wav");
break;
}
case SOUND_SHUFFLE: {
engineSound->play2D("./sound/shuffle.wav");
break;
}
case SOUND_DAMAGE: {
engineSound->play2D("./sound/damage.wav");
break;
}
case SOUND_RECOVER: {
engineSound->play2D("./sound/gainlp.wav");
break;
}
case SOUND_COUNTER_ADD: {
engineSound->play2D("./sound/addcounter.wav");
break;
}
case SOUND_COUNTER_REMOVE: {
engineSound->play2D("./sound/removecounter.wav");
break;
}
case SOUND_COIN: {
engineSound->play2D("./sound/coinflip.wav");
break;
}
case SOUND_DICE: {
engineSound->play2D("./sound/diceroll.wav");
break;
}
case SOUND_NEXT_TURN: {
engineSound->play2D("./sound/nextturn.wav");
break;
}
case SOUND_PHASE: {
engineSound->play2D("./sound/phase.wav");
break;
}
case SOUND_MENU: {
engineSound->play2D("./sound/menu.wav");
break;
}
case SOUND_BUTTON: {
engineSound->play2D("./sound/button.wav");
break;
}
case SOUND_INFO: {
engineSound->play2D("./sound/info.wav");
break;
}
case SOUND_QUESTION: {
engineSound->play2D("./sound/question.wav");
break;
}
case SOUND_CARD_PICK: {
engineSound->play2D("./sound/cardpick.wav");
break;
}
case SOUND_CARD_DROP: {
engineSound->play2D("./sound/carddrop.wav");
break;
}
case SOUND_PLAYER_ENTER: {
engineSound->play2D("./sound/playerenter.wav");
break;
}
case SOUND_CHAT: {
engineSound->play2D("./sound/chatmessage.wav");
break;
}
default:
break;
} }
engineSound->setSoundVolume(gameConf.sound_volume);
} }
void Game::PlayMusic(char* song, bool loop) { void Game::PlayMusic(char* song, bool loop) {
if(mainGame->chkEnableMusic->isChecked()) { if(mainGame->chkEnableMusic->isChecked()) {
...@@ -1266,17 +1385,17 @@ void Game::AddChatMsg(wchar_t* msg, int player) { ...@@ -1266,17 +1385,17 @@ void Game::AddChatMsg(wchar_t* msg, int player) {
chatMsg[0].append(L": "); chatMsg[0].append(L": ");
break; break;
case 1: //from client case 1: //from client
mainGame->PlaySoundEffect("./sound/chatmessage.wav"); mainGame->PlaySoundEffect(SOUND_CHAT);
chatMsg[0].append(dInfo.clientname); chatMsg[0].append(dInfo.clientname);
chatMsg[0].append(L": "); chatMsg[0].append(L": ");
break; break;
case 2: //host tag case 2: //host tag
mainGame->PlaySoundEffect("./sound/chatmessage.wav"); mainGame->PlaySoundEffect(SOUND_CHAT);
chatMsg[0].append(dInfo.hostname_tag); chatMsg[0].append(dInfo.hostname_tag);
chatMsg[0].append(L": "); chatMsg[0].append(L": ");
break; break;
case 3: //client tag case 3: //client tag
mainGame->PlaySoundEffect("./sound/chatmessage.wav"); mainGame->PlaySoundEffect(SOUND_CHAT);
chatMsg[0].append(dInfo.clientname_tag); chatMsg[0].append(dInfo.clientname_tag);
chatMsg[0].append(L": "); chatMsg[0].append(L": ");
break; break;
...@@ -1285,7 +1404,7 @@ void Game::AddChatMsg(wchar_t* msg, int player) { ...@@ -1285,7 +1404,7 @@ void Game::AddChatMsg(wchar_t* msg, int player) {
chatMsg[0].append(L": "); chatMsg[0].append(L": ");
break; break;
case 8: //system custom message, no prefix. case 8: //system custom message, no prefix.
mainGame->PlaySoundEffect("./sound/chatmessage.wav"); mainGame->PlaySoundEffect(SOUND_CHAT);
chatMsg[0].append(L"[System]: "); chatMsg[0].append(L"[System]: ");
break; break;
case 9: //error message case 9: //error message
......
...@@ -120,7 +120,7 @@ public: ...@@ -120,7 +120,7 @@ public:
void AddDebugMsg(char* msgbuf); void AddDebugMsg(char* msgbuf);
void ClearTextures(); void ClearTextures();
void CloseDuelWindow(); void CloseDuelWindow();
void PlaySoundEffect(char* sound); void PlaySoundEffect(int sound);
void PlayMusic(char* song, bool loop); void PlayMusic(char* song, bool loop);
void PlayBGM(); void PlayBGM();
...@@ -581,5 +581,37 @@ extern Game* mainGame; ...@@ -581,5 +581,37 @@ extern Game* mainGame;
#define BUTTON_MARKS_FILTER 380 #define BUTTON_MARKS_FILTER 380
#define BUTTON_MARKERS_OK 381 #define BUTTON_MARKERS_OK 381
#define SOUND_SUMMON 101
#define SOUND_SPECIAL_SUMMON 102
#define SOUND_ACTIVATE 103
#define SOUND_SET 104
#define SOUND_FILP 105
#define SOUND_REVEAL 106
#define SOUND_EQUIP 107
#define SOUND_DESTROYED 108
#define SOUND_BANISHED 109
#define SOUND_ATTACK 201
#define SOUND_DIRECT_ATTACK 202
#define SOUND_DRAW 203
#define SOUND_SHUFFLE 204
#define SOUND_DAMAGE 205
#define SOUND_RECOVER 206
#define SOUND_COUNTER_ADD 207
#define SOUND_COUNTER_REMOVE 208
#define SOUND_COIN 209
#define SOUND_DICE 210
#define SOUND_NEXT_TURN 211
#define SOUND_PHASE 212
#define SOUND_MENU 301
#define SOUND_BUTTON 302
#define SOUND_INFO 303
#define SOUND_QUESTION 304
#define SOUND_CARD_PICK 305
#define SOUND_CARD_DROP 306
#define SOUND_PLAYER_ENTER 307
#define SOUND_CHAT 308
#define DEFAULT_DUEL_RULE 4 #define DEFAULT_DUEL_RULE 4
#endif // GAME_H #endif // GAME_H
...@@ -17,6 +17,10 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -17,6 +17,10 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
s32 id = caller->getID(); s32 id = caller->getID();
switch(event.GUIEvent.EventType) { switch(event.GUIEvent.EventType) {
case irr::gui::EGET_BUTTON_CLICKED: { case irr::gui::EGET_BUTTON_CLICKED: {
if(id < 110)
mainGame->PlaySoundEffect(SOUND_MENU);
else
mainGame->PlaySoundEffect(SOUND_BUTTON);
switch(id) { switch(id) {
case BUTTON_MODE_EXIT: { case BUTTON_MODE_EXIT: {
mainGame->device->closeDevice(); mainGame->device->closeDevice();
......
...@@ -174,6 +174,7 @@ int ReplayMode::ReplayThread(void* param) { ...@@ -174,6 +174,7 @@ int ReplayMode::ReplayThread(void* param) {
if(mainGame->wCardSelect->isVisible()) if(mainGame->wCardSelect->isVisible())
mainGame->HideElement(mainGame->wCardSelect); mainGame->HideElement(mainGame->wCardSelect);
mainGame->PopupElement(mainGame->wMessage); mainGame->PopupElement(mainGame->wMessage);
mainGame->PlaySoundEffect(SOUND_INFO);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->actionSignal.Wait(); mainGame->actionSignal.Wait();
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
...@@ -327,6 +328,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) { ...@@ -327,6 +328,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->stMessage->setText(L"Error occurs."); mainGame->stMessage->setText(L"Error occurs.");
mainGame->PopupElement(mainGame->wMessage); mainGame->PopupElement(mainGame->wMessage);
mainGame->PlaySoundEffect(SOUND_INFO);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->actionSignal.Reset(); mainGame->actionSignal.Reset();
mainGame->actionSignal.Wait(); mainGame->actionSignal.Wait();
......
...@@ -132,6 +132,7 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) { ...@@ -132,6 +132,7 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->stMessage->setText(L"Error occurs."); mainGame->stMessage->setText(L"Error occurs.");
mainGame->PopupElement(mainGame->wMessage); mainGame->PopupElement(mainGame->wMessage);
mainGame->PlaySoundEffect(SOUND_INFO);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->actionSignal.Reset(); mainGame->actionSignal.Reset();
mainGame->actionSignal.Wait(); mainGame->actionSignal.Wait();
...@@ -738,6 +739,7 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) { ...@@ -738,6 +739,7 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
mainGame->gMutex.Lock(); mainGame->gMutex.Lock();
mainGame->SetStaticText(mainGame->stMessage, 310, mainGame->textFont, msg); mainGame->SetStaticText(mainGame->stMessage, 310, mainGame->textFont, msg);
mainGame->PopupElement(mainGame->wMessage); mainGame->PopupElement(mainGame->wMessage);
mainGame->PlaySoundEffect(SOUND_INFO);
mainGame->gMutex.Unlock(); mainGame->gMutex.Unlock();
mainGame->actionSignal.Reset(); mainGame->actionSignal.Reset();
mainGame->actionSignal.Wait(); mainGame->actionSignal.Wait();
......
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