diff --git a/cockatrice/src/messagelogwidget.cpp b/cockatrice/src/messagelogwidget.cpp index 8b80d5e5..a1fffb25 100644 --- a/cockatrice/src/messagelogwidget.cpp +++ b/cockatrice/src/messagelogwidget.cpp @@ -803,7 +803,7 @@ void MessageLogWidget::logSetActivePhase(int phase) case 1: phaseName = tr("upkeep step"); break; case 2: phaseName = tr("draw step"); break; case 3: phaseName = tr("first main phase"); break; - case 4: phaseName = tr("beginning of combat step"); break; + case 4: phaseName = tr("beginning of combat step"); soundEngine->startCombat(); break; case 5: phaseName = tr("declare attackers step"); break; case 6: phaseName = tr("declare blockers step"); break; case 7: phaseName = tr("combat damage step"); break; diff --git a/cockatrice/src/soundengine.cpp b/cockatrice/src/soundengine.cpp index 6bcaeded..98e53651 100644 --- a/cockatrice/src/soundengine.cpp +++ b/cockatrice/src/soundengine.cpp @@ -17,12 +17,13 @@ SoundEngine::SoundEngine(QObject *parent) lastTapPlayed = QDateTime::currentDateTime(); lastEndStepPlayed = QDateTime::currentDateTime(); + lastStartCombatPlayed = QDateTime::currentDateTime(); } void SoundEngine::cacheData() { static const QStringList fileNames = QStringList() - << "end_step" << "tap" << "player_joined"; + << "end_step" << "tap" << "player_joined" << "start_combat"; for (int i = 0; i < fileNames.size(); ++i) { QFile file(settingsCache->getSoundPath() + "/" + fileNames[i] + ".raw"); if(!file.exists()) @@ -92,3 +93,10 @@ void SoundEngine::playerJoined() { playSound("player_joined"); } + + +void SoundEngine::startCombat() { + if (lastStartCombatPlayed.secsTo(QDateTime::currentDateTime()) >= 1) + playSound("start_combat"); + lastStartCombatPlayed = QDateTime::currentDateTime(); +} diff --git a/cockatrice/src/soundengine.h b/cockatrice/src/soundengine.h index f15b3931..ea23d7af 100644 --- a/cockatrice/src/soundengine.h +++ b/cockatrice/src/soundengine.h @@ -17,6 +17,7 @@ private: QAudioOutput *audio; QDateTime lastTapPlayed; QDateTime lastEndStepPlayed; + QDateTime lastStartCombatPlayed; private slots: void cacheData(); void soundEnabledChanged(); @@ -26,6 +27,7 @@ public slots: void endStep(); void tap(); void playerJoined(); + void startCombat(); }; extern SoundEngine *soundEngine; diff --git a/sounds/player_joined.raw b/sounds/player_joined.raw index 35229fec..d3294958 100644 Binary files a/sounds/player_joined.raw and b/sounds/player_joined.raw differ diff --git a/sounds/start_combat.raw b/sounds/start_combat.raw new file mode 100644 index 00000000..d9edd2a2 Binary files /dev/null and b/sounds/start_combat.raw differ