aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/lastexpress/entities/anna.cpp16
-rw-r--r--engines/lastexpress/entities/august.cpp6
-rw-r--r--engines/lastexpress/entities/chapters.cpp72
-rw-r--r--engines/lastexpress/entities/coudert.cpp2
-rw-r--r--engines/lastexpress/entities/francois.cpp4
-rw-r--r--engines/lastexpress/entities/kahina.cpp6
-rw-r--r--engines/lastexpress/entities/kronos.cpp2
-rw-r--r--engines/lastexpress/entities/mahmud.cpp2
-rw-r--r--engines/lastexpress/entities/max.cpp12
-rw-r--r--engines/lastexpress/entities/milos.cpp14
-rw-r--r--engines/lastexpress/entities/pascale.cpp4
-rw-r--r--engines/lastexpress/entities/salko.cpp2
-rw-r--r--engines/lastexpress/entities/tables.cpp8
-rw-r--r--engines/lastexpress/entities/tatiana.cpp8
-rw-r--r--engines/lastexpress/entities/train.cpp4
-rw-r--r--engines/lastexpress/entities/vassili.cpp2
-rw-r--r--engines/lastexpress/entities/verges.cpp6
-rw-r--r--engines/lastexpress/fight/fight.cpp6
-rw-r--r--engines/lastexpress/fight/fighter_anna.cpp4
-rw-r--r--engines/lastexpress/fight/fighter_ivo.cpp4
-rw-r--r--engines/lastexpress/fight/fighter_milos.cpp4
-rw-r--r--engines/lastexpress/fight/fighter_salko.cpp4
-rw-r--r--engines/lastexpress/fight/fighter_vesna.cpp4
-rw-r--r--engines/lastexpress/game/action.cpp4
-rw-r--r--engines/lastexpress/game/entities.cpp4
-rw-r--r--engines/lastexpress/game/inventory.cpp2
-rw-r--r--engines/lastexpress/game/logic.cpp8
-rw-r--r--engines/lastexpress/game/savegame.cpp2
-rw-r--r--engines/lastexpress/game/scenes.cpp4
-rw-r--r--engines/lastexpress/menu/menu.cpp18
-rw-r--r--engines/lastexpress/shared.h46
-rw-r--r--engines/lastexpress/sound/entry.cpp99
-rw-r--r--engines/lastexpress/sound/entry.h87
-rw-r--r--engines/lastexpress/sound/queue.cpp74
-rw-r--r--engines/lastexpress/sound/queue.h38
-rw-r--r--engines/lastexpress/sound/sound.cpp32
-rw-r--r--engines/lastexpress/sound/sound.h6
37 files changed, 309 insertions, 311 deletions
diff --git a/engines/lastexpress/entities/anna.cpp b/engines/lastexpress/entities/anna.cpp
index 37c6d1065c..c2d2054fed 100644
--- a/engines/lastexpress/entities/anna.cpp
+++ b/engines/lastexpress/entities/anna.cpp
@@ -315,7 +315,7 @@ IMPLEMENT_FUNCTION(12, Anna, practiceMusic)
params->param4 = 0;
params->param5 = 1;
} else {
- getSoundQueue()->removeFromQueue(kEntityAnna);
+ getSoundQueue()->stop(kEntityAnna);
getObjects()->update(kObjectCompartmentF, kEntityAnna, kObjectLocation1, kCursorNormal, kCursorNormal);
getObjects()->update(kObject53, kEntityAnna, kObjectLocation1, kCursorNormal, kCursorNormal);
@@ -326,7 +326,7 @@ IMPLEMENT_FUNCTION(12, Anna, practiceMusic)
break;
case kActionOpenDoor:
- getSoundQueue()->removeFromQueue(kEntityAnna);
+ getSoundQueue()->stop(kEntityAnna);
setCallback(3);
setup_playSound("LIB013");
break;
@@ -343,7 +343,7 @@ IMPLEMENT_FUNCTION(12, Anna, practiceMusic)
getEntities()->drawSequenceLeft(kEntityAnna, "418C");
if (getSoundQueue()->isBuffered(kEntityAnna))
- getSoundQueue()->processEntry(kEntityAnna);
+ getSoundQueue()->fade(kEntityAnna);
getSound()->playSound(kEntityAnna, "ANN2135A");
break;
@@ -1533,7 +1533,7 @@ IMPLEMENT_FUNCTION(35, Anna, wakeNight)
case kActionKnock:
case kActionOpenDoor:
if (getSoundQueue()->isBuffered(kEntityAnna))
- getSoundQueue()->processEntry(kEntityAnna);
+ getSoundQueue()->fade(kEntityAnna);
if (savepoint.action == kActionKnock)
getSound()->playSound(kEntityPlayer, "LIB012");
@@ -1576,7 +1576,7 @@ IMPLEMENT_FUNCTION(35, Anna, wakeNight)
case kAction226031488:
if (getSoundQueue()->isBuffered(kEntityAnna))
- getSoundQueue()->processEntry(kEntityAnna);
+ getSoundQueue()->fade(kEntityAnna);
getSavePoints()->push(kEntityAnna, kEntityMax, kAction71277948);
break;
@@ -3175,7 +3175,7 @@ IMPLEMENT_FUNCTION(63, Anna, deadBaggageCompartment)
// Anna will get killed...
case kAction272177921:
if (getSoundQueue()->isBuffered("MUS012"))
- getSoundQueue()->processEntry("MUS012");
+ getSoundQueue()->fade("MUS012");
setCallback(1);
setup_savegame(kSavegameTypeEvent, kEventAnnaKilled);
@@ -3961,7 +3961,7 @@ IMPLEMENT_FUNCTION(80, Anna, finalSequence)
case 1:
if (getSoundQueue()->isBuffered(kEntityAnna))
- getSoundQueue()->processEntry(kEntityAnna);
+ getSoundQueue()->fade(kEntityAnna);
getAction()->playAnimation(kEventKronosBringFirebird);
getScenes()->loadSceneFromItem(kItemFirebird);
@@ -3977,7 +3977,7 @@ IMPLEMENT_FUNCTION(80, Anna, finalSequence)
getProgress().isEggOpen = true;
if (getSoundQueue()->isBuffered(kEntityAnna))
- getSoundQueue()->processEntry(kEntityAnna);
+ getSoundQueue()->fade(kEntityAnna);
getAction()->playAnimation(kEventKronosOpenFirebird);
getScenes()->loadSceneFromPosition(kCarRestaurant, 3);
diff --git a/engines/lastexpress/entities/august.cpp b/engines/lastexpress/entities/august.cpp
index 434d09c196..9750de71eb 100644
--- a/engines/lastexpress/entities/august.cpp
+++ b/engines/lastexpress/entities/august.cpp
@@ -3535,9 +3535,9 @@ IMPLEMENT_FUNCTION(69, August, unhookCars)
break;
case kActionDefault:
- getSoundQueue()->processEntries();
+ getSoundQueue()->endAmbient();
if (getSoundQueue()->isBuffered("ARRIVE"))
- getSoundQueue()->removeFromQueue("ARRIVE");
+ getSoundQueue()->stop("ARRIVE");
setCallback(1);
setup_savegame(kSavegameTypeEvent, kEventAugustUnhookCarsBetrayal);
@@ -3547,7 +3547,7 @@ IMPLEMENT_FUNCTION(69, August, unhookCars)
if (getCallback() == 1) {
getAction()->playAnimation(getProgress().field_C ? kEventAugustUnhookCarsBetrayal : kEventAugustUnhookCars);
getEntities()->clearSequences(kEntityAugust);
- getSoundQueue()->resetState();
+ getSoundQueue()->startAmbient();
getSound()->playSound(kEntityPlayer, "MUS050");
getScenes()->loadSceneFromPosition(kCarRestaurant, 85, 1);
getSavePoints()->pushAll(kEntityAugust, kActionProceedChapter5);
diff --git a/engines/lastexpress/entities/chapters.cpp b/engines/lastexpress/entities/chapters.cpp
index 95d1092fd8..8346d7836d 100644
--- a/engines/lastexpress/entities/chapters.cpp
+++ b/engines/lastexpress/entities/chapters.cpp
@@ -173,9 +173,9 @@ IMPLEMENT_FUNCTION(6, Chapters, firstDream)
case kActionOpenDoor:
if (params->param1) {
getEntities()->clearSequences(kEntityChapters);
- getSoundQueue()->processEntry(kEntityChapters);
+ getSoundQueue()->fade(kEntityChapters);
getSound()->playSound(kEntityPlayer, "LIB014");
- getSoundQueue()->resetState();
+ getSoundQueue()->startAmbient();
ENTITY_PARAM(0, 4) = 7;
@@ -243,30 +243,30 @@ IMPLEMENT_FUNCTION(6, Chapters, firstDream)
RESET_ENTITY_STATE(kEntityHadija, Alouan, setup_function12);
if (ENTITY_PARAM(0, 2) || ENTITY_PARAM(0, 3)) {
- getSoundQueue()->removeFromQueue(kEntityChapters);
+ getSoundQueue()->stop(kEntityChapters);
ENTITY_PARAM(0, 2) = 0;
ENTITY_PARAM(0, 3) = 0;
}
- getSoundQueue()->processEntries();
+ getSoundQueue()->endAmbient();
if (getSoundQueue()->isBuffered("CON1505"))
- getSoundQueue()->processEntry("CON1505");
+ getSoundQueue()->fade("CON1505");
if (getSoundQueue()->isBuffered("AUG1057"))
- getSoundQueue()->processEntry("AUG1057");
+ getSoundQueue()->fade("AUG1057");
if (getSoundQueue()->isBuffered("ZFX1005"))
- getSoundQueue()->processEntry("ZFX1005");
+ getSoundQueue()->fade("ZFX1005");
else if (getSoundQueue()->isBuffered("ZFX1006"))
- getSoundQueue()->processEntry("ZFX1006");
+ getSoundQueue()->fade("ZFX1006");
else if (getSoundQueue()->isBuffered("ZFX1007"))
- getSoundQueue()->processEntry("ZFX1007");
+ getSoundQueue()->fade("ZFX1007");
else if (getSoundQueue()->isBuffered("ZFX1007A"))
- getSoundQueue()->processEntry("ZFX1007A");
+ getSoundQueue()->fade("ZFX1007A");
else if (getSoundQueue()->isBuffered("ZFX1007B"))
- getSoundQueue()->processEntry("ZFX1007B");
+ getSoundQueue()->fade("ZFX1007B");
getSound()->playSound(kEntityPlayer, "MUS008", kVolumeFull);
getInventory()->unselectItem();
@@ -317,7 +317,7 @@ IMPLEMENT_FUNCTION(7, Chapters, chapter1Init)
return;
getProgress().chapter = kChapter1;
- getSoundQueue()->resetState();
+ getSoundQueue()->startAmbient();
getState()->time = kTimeStartGame;
getState()->timeDelta = 0;
@@ -584,7 +584,7 @@ label_chapter1_next:
}
if (ENTITY_PARAM(0, 3)) {
- getSoundQueue()->resetState();
+ getSoundQueue()->startAmbient();
ENTITY_PARAM(0, 3) = 0;
if (params->param4) {
@@ -715,7 +715,7 @@ IMPLEMENT_FUNCTION(9, Chapters, chapter1Next)
if (savepoint.action == kActionDefault) {
// Reset sound cache
if (ENTITY_PARAM(0, 2) || ENTITY_PARAM(0, 3)) {
- getSoundQueue()->removeFromQueue(kEntityChapters);
+ getSoundQueue()->stop(kEntityChapters);
ENTITY_PARAM(0, 2) = 0;
ENTITY_PARAM(0, 3) = 0;
}
@@ -814,7 +814,7 @@ IMPLEMENT_FUNCTION(11, Chapters, chapter2Init)
// Reset sound cache
if (ENTITY_PARAM(0, 2) || ENTITY_PARAM(0, 3)) {
- getSoundQueue()->removeFromQueue(kEntityChapters);
+ getSoundQueue()->stop(kEntityChapters);
ENTITY_PARAM(0, 2) = 0;
ENTITY_PARAM(0, 3) = 0;
}
@@ -899,7 +899,7 @@ IMPLEMENT_FUNCTION(14, Chapters, chapter3Init)
getObjects()->update(kObject107, kEntityPlayer, kObjectLocation3, kCursorKeepValue, kCursorKeepValue);
if (ENTITY_PARAM(0, 2) || ENTITY_PARAM(0, 3)) {
- getSoundQueue()->removeFromQueue(kEntityChapters);
+ getSoundQueue()->stop(kEntityChapters);
ENTITY_PARAM(0, 2) = 0;
ENTITY_PARAM(0, 3) = 0;
}
@@ -1023,7 +1023,7 @@ label_callback_8:
}
}
- getSoundQueue()->resetState();
+ getSoundQueue()->startAmbient();
getSound()->playSteam((CityIndex)ENTITY_PARAM(0, 4));
ENTITY_PARAM(0, 2) = 0;
@@ -1034,7 +1034,7 @@ label_callback_8:
}
if (ENTITY_PARAM(0, 3)) {
- getSoundQueue()->resetState();
+ getSoundQueue()->startAmbient();
ENTITY_PARAM(0, 3) = 0;
}
break;
@@ -1091,7 +1091,7 @@ IMPLEMENT_FUNCTION(16, Chapters, viennaEvents)
case kActionDefault:
getEntityData(kEntityPlayer)->car = kCarLocomotive;
if (getSoundQueue()->isBuffered(kEntityAbbot))
- getSoundQueue()->processEntry(kEntityAbbot);
+ getSoundQueue()->fade(kEntityAbbot);
if (!getEvent(kEventAugustBringBriefcase)) {
setCallback(1);
@@ -1208,8 +1208,8 @@ IMPLEMENT_FUNCTION(18, Chapters, chapter4Init)
if (savepoint.action != kActionDefault)
return;
- getSoundQueue()->processEntries();
- getSoundQueue()->resetState();
+ getSoundQueue()->endAmbient();
+ getSoundQueue()->startAmbient();
getProgress().isTrainRunning = true;
@@ -1235,7 +1235,7 @@ IMPLEMENT_FUNCTION(18, Chapters, chapter4Init)
getObjects()->update(kObject107, kEntityPlayer, kObjectLocation3, kCursorKeepValue, kCursorKeepValue);
if (ENTITY_PARAM(0, 2) || ENTITY_PARAM(0, 3)) {
- getSoundQueue()->removeFromQueue(kEntityChapters);
+ getSoundQueue()->stop(kEntityChapters);
ENTITY_PARAM(0, 2) = 0;
ENTITY_PARAM(0, 3) = 0;
}
@@ -1384,7 +1384,7 @@ label_callback_4:
}
if (ENTITY_PARAM(0, 3)) {
- getSoundQueue()->resetState();
+ getSoundQueue()->startAmbient();
ENTITY_PARAM(0, 3) = 0;
} else if (!params->param2 && !params->param3) {
getSound()->playSound(kEntityChapters, "ZFX1001");
@@ -1422,16 +1422,16 @@ label_callback_4:
case 5:
if (getSoundQueue()->isBuffered(kEntityChapters))
- getSoundQueue()->removeFromQueue(kEntityChapters);
+ getSoundQueue()->stop(kEntityChapters);
getAction()->playAnimation(kEventTrainExplosionBridge);
getLogic()->gameOver(kSavegameTypeIndex, 1, kSceneNone, true);
break;
case 6:
- getSoundQueue()->processEntries();
+ getSoundQueue()->endAmbient();
getAction()->playAnimation(kEventTylerCastleDream);
- getSoundQueue()->resetState();
+ getSoundQueue()->startAmbient();
getProgress().field_18 = 1;
@@ -1530,7 +1530,7 @@ label_callback_4:
params->param1 = 1;
if (ENTITY_PARAM(0, 2) || ENTITY_PARAM(0, 3)) {
- getSoundQueue()->removeFromQueue(kEntityChapters);
+ getSoundQueue()->stop(kEntityChapters);
ENTITY_PARAM(0, 2) = 0;
ENTITY_PARAM(0, 3) = 0;
@@ -1593,7 +1593,7 @@ label_callback_4:
getState()->time = kTime2520000;
if (getSoundQueue()->isBuffered(kEntityChapters))
- getSoundQueue()->removeFromQueue(kEntityChapters);
+ getSoundQueue()->stop(kEntityChapters);
getEntities()->clearSequences(kEntityChapters);
getInventory()->removeItem(kItemTelegram);
@@ -1606,7 +1606,7 @@ label_callback_4:
case kAction201959744:
if (getSoundQueue()->isBuffered(kEntityChapters))
- getSoundQueue()->removeFromQueue(kEntityChapters);
+ getSoundQueue()->stop(kEntityChapters);
getSound()->playSound(kEntityTrain, "ZFX4001", kVolumeFull);
@@ -1714,7 +1714,7 @@ IMPLEMENT_FUNCTION(21, Chapters, chapter5Init)
getObjects()->updateModel(kObjectRestaurantCar, kObjectModel2);
if (ENTITY_PARAM(0, 2) || ENTITY_PARAM(0, 3)) {
- getSoundQueue()->removeFromQueue(kEntityChapters);
+ getSoundQueue()->stop(kEntityChapters);
ENTITY_PARAM(0, 2) = 0;
ENTITY_PARAM(0, 3) = 0;
}
@@ -1747,7 +1747,7 @@ IMPLEMENT_FUNCTION(22, Chapters, chapter5Handler)
if (!getProgress().isNightTime) {
getSound()->playSound(kEntityChapters, "ARRIVE", kVolume8);
- getSoundQueue()->processEntries();
+ getSoundQueue()->endAmbient();
}
}
@@ -1756,7 +1756,7 @@ IMPLEMENT_FUNCTION(22, Chapters, chapter5Handler)
if (!getEvent(kEventLocomotiveMilosDay) && !getEvent(kEventLocomotiveMilosNight)) {
getSound()->playSound(kEntityChapters, "ARRIVE", kVolume8);
- getSoundQueue()->processEntries();
+ getSoundQueue()->endAmbient();
}
}
break;
@@ -1786,7 +1786,7 @@ IMPLEMENT_FUNCTION(22, Chapters, chapter5Handler)
getState()->time = kTime2916000;
if (getSoundQueue()->isBuffered(kEntityChapters))
- getSoundQueue()->removeFromQueue(kEntityChapters);
+ getSoundQueue()->stop(kEntityChapters);
break;
}
IMPLEMENT_FUNCTION_END
@@ -1801,7 +1801,7 @@ void Chapters::enterExitStation(const SavePoint &savepoint, bool isEnteringStati
return;
}
- getSoundQueue()->removeFromQueue(kEntityChapters);
+ getSoundQueue()->stop(kEntityChapters);
if (!ENTITY_PARAM(0, 2)) {
if (ENTITY_PARAM(0, 3))
@@ -1869,7 +1869,7 @@ void Chapters::enterExitHelper(bool isEnteringStation) {
EXPOSE_PARAMS(EntityData::EntityParametersSIIS);
getSound()->playSound(kEntityChapters, isEnteringStation ? "ARRIVE" : "DEPART", kVolume8);
- getSoundQueue()->processEntries();
+ getSoundQueue()->endAmbient();
getObjects()->update(kObjectHandleOutsideLeft, kEntityPlayer, kObjectLocation1, kCursorNormal, isEnteringStation ? kCursorNormal : kCursorHand);
getObjects()->update(kObjectHandleOutsideRight, kEntityPlayer, kObjectLocation1, kCursorNormal, isEnteringStation ? kCursorNormal : kCursorHand);
@@ -1888,7 +1888,7 @@ void Chapters::enterExitHelper(bool isEnteringStation) {
}
void Chapters::playSteam() const {
- getSoundQueue()->resetState();
+ getSoundQueue()->startAmbient();
getSound()->playSteam((CityIndex)ENTITY_PARAM(0, 4));
ENTITY_PARAM(0, 2) = 0;
}
diff --git a/engines/lastexpress/entities/coudert.cpp b/engines/lastexpress/entities/coudert.cpp
index af06d610e7..89053b79cd 100644
--- a/engines/lastexpress/entities/coudert.cpp
+++ b/engines/lastexpress/entities/coudert.cpp
@@ -2013,7 +2013,7 @@ IMPLEMENT_FUNCTION(37, Coudert, function37)
case kActionDefault:
if (getSoundQueue()->isBuffered(kEntityCoudert))
- getSoundQueue()->processEntry(kEntityCoudert);
+ getSoundQueue()->fade(kEntityCoudert);
if (ENTITY_PARAM(0, 7)) {
getData()->entityPosition = kPosition_8200;
diff --git a/engines/lastexpress/entities/francois.cpp b/engines/lastexpress/entities/francois.cpp
index be95f31419..ed56971396 100644
--- a/engines/lastexpress/entities/francois.cpp
+++ b/engines/lastexpress/entities/francois.cpp
@@ -375,7 +375,7 @@ label_callback:
getData()->inventoryItem = kItemNone;
if (getSoundQueue()->isBuffered(kEntityFrancois))
- getSoundQueue()->processEntry(kEntityFrancois);
+ getSoundQueue()->fade(kEntityFrancois);
setCallback(4);
setup_doWalk(kCarRedSleeping, kPosition_5790);
@@ -386,7 +386,7 @@ label_callback:
getData()->inventoryItem = kItemNone;
if (getSoundQueue()->isBuffered(kEntityFrancois))
- getSoundQueue()->processEntry(kEntityFrancois);
+ getSoundQueue()->fade(kEntityFrancois);
setCallback(6);
setup_savegame(kSavegameTypeEvent, kEventFrancoisWhistle);
diff --git a/engines/lastexpress/entities/kahina.cpp b/engines/lastexpress/entities/kahina.cpp
index accbe7dcdc..a10ff40e42 100644
--- a/engines/lastexpress/entities/kahina.cpp
+++ b/engines/lastexpress/entities/kahina.cpp
@@ -608,7 +608,7 @@ label_callback_3:
if (getEvent(kEventKahinaAskSpeakFirebird)) {
if (getSoundQueue()->isBuffered(kEntityKahina))
- getSoundQueue()->processEntry(kEntityKahina);
+ getSoundQueue()->fade(kEntityKahina);
if (savepoint.action == kActionKnock)
getSound()->playSound(kEntityPlayer, "LIB012");
@@ -1166,7 +1166,7 @@ IMPLEMENT_FUNCTION(24, Kahina, seekCath)
if (ENTITY_PARAM(0, 2)) {
getEntities()->clearSequences(kEntityKahina);
if (getSoundQueue()->isBuffered(kEntityKahina))
- getSoundQueue()->processEntry(kEntityKahina);
+ getSoundQueue()->fade(kEntityKahina);
getProgress().field_44 = 0;
@@ -1201,7 +1201,7 @@ IMPLEMENT_FUNCTION(24, Kahina, seekCath)
case kAction137503360:
getEntities()->clearSequences(kEntityKahina);
if (getSoundQueue()->isBuffered(kEntityKahina))
- getSoundQueue()->processEntry(kEntityKahina);
+ getSoundQueue()->fade(kEntityKahina);
getProgress().field_44 = 0;
diff --git a/engines/lastexpress/entities/kronos.cpp b/engines/lastexpress/entities/kronos.cpp
index 71ae6dcfa5..0651b84490 100644
--- a/engines/lastexpress/entities/kronos.cpp
+++ b/engines/lastexpress/entities/kronos.cpp
@@ -486,7 +486,7 @@ IMPLEMENT_FUNCTION(19, Kronos, startConcert)
case 2:
getAction()->playAnimation(kEventConcertStart);
- getSoundQueue()->setupEntry(kSoundType7, kEntityKronos);
+ getSoundQueue()->assignNISLink(kEntityKronos);
getScenes()->loadSceneFromPosition(kCarKronos, 83);
RESET_ENTITY_STATE(kEntityRebecca, Rebecca, setup_function39);
diff --git a/engines/lastexpress/entities/mahmud.cpp b/engines/lastexpress/entities/mahmud.cpp
index 47a9e85716..b944f82dcd 100644
--- a/engines/lastexpress/entities/mahmud.cpp
+++ b/engines/lastexpress/entities/mahmud.cpp
@@ -399,7 +399,7 @@ IMPLEMENT_FUNCTION(11, Mahmud, function11)
case kAction123852928:
if (getSoundQueue()->isBuffered(kEntityMahmud))
- getSoundQueue()->processEntry(kEntityMahmud);
+ getSoundQueue()->fade(kEntityMahmud);
getObjects()->update(kObjectCompartment5, kEntityTrain, kObjectLocation3, kCursorHandKnock, kCursorHand);
getObjects()->update(kObjectCompartment6, kEntityTrain, kObjectLocation3, kCursorHandKnock, kCursorHand);
diff --git a/engines/lastexpress/entities/max.cpp b/engines/lastexpress/entities/max.cpp
index 180bc1d1ca..661c59187c 100644
--- a/engines/lastexpress/entities/max.cpp
+++ b/engines/lastexpress/entities/max.cpp
@@ -140,7 +140,7 @@ IMPLEMENT_FUNCTION(7, Max, guardingCompartment)
getObjects()->update(kObject53, kEntityMax, kObjectLocation1, kCursorNormal, kCursorNormal);
if (getSoundQueue()->isBuffered(kEntityMax))
- getSoundQueue()->processEntry(kEntityMax);
+ getSoundQueue()->fade(kEntityMax);
setCallback((savepoint.action == kActionKnock) ? 1 : 2);
setup_playSound((savepoint.action == kActionKnock) ? "LIB012" : "LIB013");
@@ -232,7 +232,7 @@ IMPLEMENT_FUNCTION(8, Max, inCageFriendly)
}
if (getSoundQueue()->isBuffered(kEntityMax))
- getSoundQueue()->processEntry(kEntityMax);
+ getSoundQueue()->fade(kEntityMax);
getAction()->playAnimation(kEventCathMaxLickHand);
getScenes()->processScene();
@@ -259,7 +259,7 @@ IMPLEMENT_FUNCTION(8, Max, inCageFriendly)
break;
if (getSoundQueue()->isBuffered(kEntityMax))
- getSoundQueue()->processEntry(kEntityMax);
+ getSoundQueue()->fade(kEntityMax);
getSound()->playSound(kEntityPlayer, "LIB026");
getAction()->playAnimation(kEventCathMaxFree);
@@ -483,16 +483,16 @@ IMPLEMENT_FUNCTION(14, Max, inCageMad)
case 1:
if (getSoundQueue()->isBuffered(kEntityMax))
- getSoundQueue()->removeFromQueue(kEntityMax);
+ getSoundQueue()->stop(kEntityMax);
getAction()->playAnimation(kEventCathMaxCage);
- getSoundQueue()->setupEntry(kSoundType7, kEntityMax);
+ getSoundQueue()->assignNISLink(kEntityMax);
getScenes()->processScene();
break;
case 2:
if (getSoundQueue()->isBuffered(kEntityMax))
- getSoundQueue()->processEntry(kEntityMax);
+ getSoundQueue()->fade(kEntityMax);
getSound()->playSound(kEntityPlayer, "LIB026");
getAction()->playAnimation(kEventCathMaxFree);
diff --git a/engines/lastexpress/entities/milos.cpp b/engines/lastexpress/entities/milos.cpp
index fb139f96ac..a9e0d80407 100644
--- a/engines/lastexpress/entities/milos.cpp
+++ b/engines/lastexpress/entities/milos.cpp
@@ -1592,7 +1592,7 @@ IMPLEMENT_FUNCTION(29, Milos, chapter4Handler)
case kAction221683008:
if (getSoundQueue()->isBuffered(kEntityMilos))
- getSoundQueue()->processEntry(kEntityMilos);
+ getSoundQueue()->fade(kEntityMilos);
params->param1 = 1;
getSavePoints()->push(kEntityMilos, kEntityCoudert, kAction123199584);
@@ -1735,14 +1735,14 @@ IMPLEMENT_FUNCTION(34, Milos, chapter5Handler)
case 2:
if (getSoundQueue()->isBuffered("MUS050"))
- getSoundQueue()->processEntry("MUS050");
+ getSoundQueue()->fade("MUS050");
if (getSoundQueue()->isBuffered("ARRIVE"))
- getSoundQueue()->removeFromQueue("ARRIVE");
+ getSoundQueue()->stop("ARRIVE");
- getSoundQueue()->processEntries();
+ getSoundQueue()->endAmbient();
getAction()->playAnimation(getProgress().isNightTime ? kEventLocomotiveMilosDay : kEventLocomotiveMilosNight);
- getSoundQueue()->setupEntry(kSoundType7, kEntityMilos);
+ getSoundQueue()->assignNISLink(kEntityMilos);
getScenes()->loadSceneFromPosition(kCarCoalTender, 1);
break;
@@ -1754,7 +1754,7 @@ IMPLEMENT_FUNCTION(34, Milos, chapter5Handler)
case 4:
getAction()->playAnimation(kEventLocomotiveRestartTrain);
getAction()->playAnimation(kEventLocomotiveOldBridge);
- getSoundQueue()->resetState();
+ getSoundQueue()->startAmbient();
getState()->time = kTime2983500;
setCallback(5);
@@ -1798,7 +1798,7 @@ IMPLEMENT_FUNCTION(34, Milos, chapter5Handler)
break;
}
- getSoundQueue()->processEntry(kEntityMilos);
+ getSoundQueue()->fade(kEntityMilos);
if (getState()->time < kTime2949300)
getState()->time = kTime2949300;
diff --git a/engines/lastexpress/entities/pascale.cpp b/engines/lastexpress/entities/pascale.cpp
index 0f19b8f44b..6112ceeea2 100644
--- a/engines/lastexpress/entities/pascale.cpp
+++ b/engines/lastexpress/entities/pascale.cpp
@@ -464,9 +464,9 @@ IMPLEMENT_FUNCTION(16, Pascale, greetTatiana)
getEntities()->updatePositionEnter(kEntityPascale, kCarRestaurant, 67);
if (getSoundQueue()->isBuffered("TAT1069A"))
- getSoundQueue()->processEntry("TAT1069A");
+ getSoundQueue()->fade("TAT1069A");
else if (getSoundQueue()->isBuffered("TAT1069B"))
- getSoundQueue()->processEntry("TAT1069B");
+ getSoundQueue()->fade("TAT1069B");
setCallback(2);
setup_playSound("TAT1066");
diff --git a/engines/lastexpress/entities/salko.cpp b/engines/lastexpress/entities/salko.cpp
index f1595d6d0f..67ea2ede02 100644
--- a/engines/lastexpress/entities/salko.cpp
+++ b/engines/lastexpress/entities/salko.cpp
@@ -602,7 +602,7 @@ IMPLEMENT_FUNCTION(24, Salko, chapter5Handler)
case 1:
if (getSoundQueue()->isBuffered("MUS050"))
- getSoundQueue()->processEntry("MUS050");
+ getSoundQueue()->fade("MUS050");
getAction()->playAnimation(kEventCathSalkoTrainTopFight);
diff --git a/engines/lastexpress/entities/tables.cpp b/engines/lastexpress/entities/tables.cpp
index b84c8c66fd..a884da4375 100644
--- a/engines/lastexpress/entities/tables.cpp
+++ b/engines/lastexpress/entities/tables.cpp
@@ -89,7 +89,7 @@ IMPLEMENT_FUNCTION_END
IMPLEMENT_FUNCTION(5, Tables, chapter5)
if (savepoint.action == kActionDefault) {
if (_id == kEntityTables2 && getSoundQueue()->isBuffered(kEntityTables2))
- getSoundQueue()->processEntry(kEntityTables2);
+ getSoundQueue()->fade(kEntityTables2);
setup_draw();
}
@@ -113,21 +113,21 @@ IMPLEMENT_FUNCTION(6, Tables, draw)
case kChapter1:
if (getState()->time > kTime1165500 && !params->param1) {
params->param1 = 1;
- getSoundQueue()->processEntry(kEntityTables2);
+ getSoundQueue()->fade(kEntityTables2);
}
break;
case kChapter3:
if (getState()->time > kTime2052000 && !params->param2) {
params->param2 = 1;
- getSoundQueue()->processEntry(kEntityTables2);
+ getSoundQueue()->fade(kEntityTables2);
}
break;
case kChapter4:
if (getState()->time > kTime2488500 && !params->param3) {
params->param3 = 1;
- getSoundQueue()->processEntry(kEntityTables2);
+ getSoundQueue()->fade(kEntityTables2);
}
break;
diff --git a/engines/lastexpress/entities/tatiana.cpp b/engines/lastexpress/entities/tatiana.cpp
index 175600fef8..28799c07c1 100644
--- a/engines/lastexpress/entities/tatiana.cpp
+++ b/engines/lastexpress/entities/tatiana.cpp
@@ -1865,7 +1865,7 @@ IMPLEMENT_FUNCTION(46, Tatiana, withAlexei)
parameters->param3 = 1;
if (parameters->param2) {
- getSoundQueue()->removeFromQueue(kEntityTatiana);
+ getSoundQueue()->stop(kEntityTatiana);
getSavePoints()->call(kEntityTatiana, kEntityTatiana, kActionEndSound);
}
} else {
@@ -2122,7 +2122,7 @@ IMPLEMENT_FUNCTION(50, Tatiana, alexeiDead)
case kActionCallback:
if (getCallback() == 1) {
if (getSoundQueue()->isBuffered("MUS013"))
- getSoundQueue()->processEntry("MUS013");
+ getSoundQueue()->fade("MUS013");
getAction()->playAnimation(kEventVassiliDeadAlexei);
getSavePoints()->push(kEntityTatiana, kEntityAbbot, kAction104060776);
@@ -2233,10 +2233,10 @@ IMPLEMENT_FUNCTION(54, Tatiana, autistic)
case kActionCallback:
if (getCallback() == 1) {
if (getSoundQueue()->isBuffered("MUS050"))
- getSoundQueue()->processEntry("MUS050");
+ getSoundQueue()->fade("MUS050");
if (getSoundQueue()->isBuffered(kEntityTatiana))
- getSoundQueue()->processEntry(kEntityTatiana);
+ getSoundQueue()->fade(kEntityTatiana);
getAction()->playAnimation(isNight() ? kEventTatianaVassiliTalkNight : kEventTatianaVassiliTalk);
getScenes()->processScene();
diff --git a/engines/lastexpress/entities/train.cpp b/engines/lastexpress/entities/train.cpp
index e4ff976cae..a8df68bddb 100644
--- a/engines/lastexpress/entities/train.cpp
+++ b/engines/lastexpress/entities/train.cpp
@@ -346,7 +346,7 @@ label_process:
} else {
params->param6 = 0;
if (getSoundQueue()->isBuffered("ZFX1001", true))
- getSoundQueue()->removeFromQueue("ZFX1001");
+ getSoundQueue()->stop("ZFX1001");
}
// Draw moving background behind windows
@@ -568,7 +568,7 @@ void Train::resetParam8() {
&& !getEntities()->isInsideCompartment(kEntityPlayer, (CarIndex)params1->param1, (EntityPosition)params1->param3)) {
if (getSoundQueue()->isBuffered((const char *)&params1->seq))
- getSoundQueue()->processEntry((const char *)&params1->seq);
+ getSoundQueue()->fade((const char *)&params1->seq);
params->param8 = 0;
}
diff --git a/engines/lastexpress/entities/vassili.cpp b/engines/lastexpress/entities/vassili.cpp
index 5696a71160..e236c65886 100644
--- a/engines/lastexpress/entities/vassili.cpp
+++ b/engines/lastexpress/entities/vassili.cpp
@@ -292,7 +292,7 @@ IMPLEMENT_FUNCTION(9, Vassili, function9)
|| getEntities()->isPlayerPosition(kCarRedSleeping, 41)) {
if (savepoint.action == kActionDrawScene)
- getSoundQueue()->processEntry(kEntityVassili);
+ getSoundQueue()->fade(kEntityVassili);
setup_seizure();
} else {
diff --git a/engines/lastexpress/entities/verges.cpp b/engines/lastexpress/entities/verges.cpp
index 9f7d0828e4..936d62b15f 100644
--- a/engines/lastexpress/entities/verges.cpp
+++ b/engines/lastexpress/entities/verges.cpp
@@ -705,7 +705,7 @@ IMPLEMENT_FUNCTION(24, Verges, policeGettingOffTrain)
case kActionCallback:
if (getCallback() == 1) {
- getSoundQueue()->processEntry(kEntityVerges);
+ getSoundQueue()->fade(kEntityVerges);
getAction()->playAnimation(kEventGendarmesArrestation);
getLogic()->gameOver(kSavegameTypeIndex, 1, kSceneGameOverPolice1, true);
}
@@ -1781,10 +1781,10 @@ IMPLEMENT_FUNCTION(40, Verges, chapter5Handler)
case kActionOpenDoor:
if (getSoundQueue()->isBuffered(kEntityVerges))
- getSoundQueue()->processEntry(kEntityVerges);
+ getSoundQueue()->fade(kEntityVerges);
if (getSoundQueue()->isBuffered("MUS050"))
- getSoundQueue()->processEntry("MUS050");
+ getSoundQueue()->fade("MUS050");
getObjects()->update(kObject65, kEntityPlayer, kObjectLocationNone, kCursorNormal, kCursorForward);
diff --git a/engines/lastexpress/fight/fight.cpp b/engines/lastexpress/fight/fight.cpp
index 47694dda3e..7f7a06fdc6 100644
--- a/engines/lastexpress/fight/fight.cpp
+++ b/engines/lastexpress/fight/fight.cpp
@@ -90,7 +90,7 @@ void Fight::eventMouse(const Common::Event &ev) {
// Handle right button click
if (ev.type == Common::EVENT_RBUTTONUP) {
- getSoundQueue()->removeFromQueue(kEntityTables0);
+ getSoundQueue()->stop(kEntityTables0);
setStopped();
getGlobalTimer() ? _state = 0 : ++_state;
@@ -137,7 +137,7 @@ void Fight::eventMouse(const Common::Event &ev) {
// Stop fight if clicked
if (ev.type == Common::EVENT_LBUTTONUP) {
_handleTimer = false;
- getSoundQueue()->removeFromQueue(kEntityTables0);
+ getSoundQueue()->stop(kEntityTables0);
bailout(kFightEndExit);
}
@@ -145,7 +145,7 @@ void Fight::eventMouse(const Common::Event &ev) {
if (ev.type == Common::EVENT_RBUTTONUP) {
if (getGlobalTimer()) {
if (getSoundQueue()->isBuffered("TIMER"))
- getSoundQueue()->removeFromQueue("TIMER");
+ getSoundQueue()->stop("TIMER");
setGlobalTimer(900);
}
diff --git a/engines/lastexpress/fight/fighter_anna.cpp b/engines/lastexpress/fight/fighter_anna.cpp
index 4fdb71a6e4..9e211e0faa 100644
--- a/engines/lastexpress/fight/fighter_anna.cpp
+++ b/engines/lastexpress/fight/fighter_anna.cpp
@@ -108,7 +108,7 @@ void FighterPlayerAnna::handleAction(FightAction action) {
}
if (_field_34 > 4) {
- getSoundQueue()->removeFromQueue(kEntityTables0);
+ getSoundQueue()->stop(kEntityTables0);
_fight->bailout(Fight::kFightEndWin);
}
}
@@ -176,7 +176,7 @@ void FighterOpponentAnna::update() {
_opponent->handleAction((FightAction)_sequenceIndex);
if (_opponent->getCountdown() <= 0) {
- getSoundQueue()->removeFromQueue(kEntityTables0);
+ getSoundQueue()->stop(kEntityTables0);
handleAction(kFightActionLost);
}
}
diff --git a/engines/lastexpress/fight/fighter_ivo.cpp b/engines/lastexpress/fight/fighter_ivo.cpp
index d5289ab0b7..8e64ce8651 100644
--- a/engines/lastexpress/fight/fighter_ivo.cpp
+++ b/engines/lastexpress/fight/fighter_ivo.cpp
@@ -111,7 +111,7 @@ void FighterPlayerIvo::update() {
if (_opponent->getCountdown() <= 0) {
setSequenceAndDraw(9, kFightSequenceType1);
_opponent->setSequenceAndDraw(8, kFightSequenceType1);
- getSoundQueue()->removeFromQueue(kEntityTables0);
+ getSoundQueue()->stop(kEntityTables0);
handleAction(kFightActionWin);
return;
@@ -228,7 +228,7 @@ void FighterOpponentIvo::update() {
if (_opponent->getCountdown() <= 0) {
setSequenceAndDraw(7, kFightSequenceType1);
_opponent->setSequenceAndDraw(8, kFightSequenceType1);
- getSoundQueue()->removeFromQueue(kEntityTables0);
+ getSoundQueue()->stop(kEntityTables0);
_opponent->handleAction(kFightActionWin);
diff --git a/engines/lastexpress/fight/fighter_milos.cpp b/engines/lastexpress/fight/fighter_milos.cpp
index 5493d26ca5..2063bf771a 100644
--- a/engines/lastexpress/fight/fighter_milos.cpp
+++ b/engines/lastexpress/fight/fighter_milos.cpp
@@ -108,7 +108,7 @@ void FighterPlayerMilos::update() {
setSequenceAndDraw(5, kFightSequenceType1);
_opponent->setSequenceAndDraw(6, kFightSequenceType1);
- getSoundQueue()->removeFromQueue(kEntityTables0);
+ getSoundQueue()->stop(kEntityTables0);
getSound()->playSound(kEntityTrain, "MUS029", kVolumeFull);
handleAction(kFightActionWin);
@@ -211,7 +211,7 @@ void FighterOpponentMilos::update() {
_opponent->handleAction((FightAction)_sequenceIndex);
if (_opponent->getCountdown() <= 0) {
- getSoundQueue()->removeFromQueue(kEntityTables0);
+ getSoundQueue()->stop(kEntityTables0);
handleAction(kFightActionLost);
}
}
diff --git a/engines/lastexpress/fight/fighter_salko.cpp b/engines/lastexpress/fight/fighter_salko.cpp
index a11bf292d5..07c72aeadd 100644
--- a/engines/lastexpress/fight/fighter_salko.cpp
+++ b/engines/lastexpress/fight/fighter_salko.cpp
@@ -96,7 +96,7 @@ void FighterPlayerSalko::update() {
if (_frame && checkFrame(2)) {
if (_opponent->getCountdown() <= 0) {
- getSoundQueue()->removeFromQueue(kEntityTables0);
+ getSoundQueue()->stop(kEntityTables0);
_fight->bailout(Fight::kFightEndWin);
return;
@@ -185,7 +185,7 @@ void FighterOpponentSalko::update() {
if (_frame && checkFrame(2)) {
if (_opponent->getCountdown() <= 0) {
- getSoundQueue()->removeFromQueue(kEntityTables0);
+ getSoundQueue()->stop(kEntityTables0);
_fight->bailout(Fight::kFightEndLost);
// Stop processing
diff --git a/engines/lastexpress/fight/fighter_vesna.cpp b/engines/lastexpress/fight/fighter_vesna.cpp
index eba30faf25..36734de82f 100644
--- a/engines/lastexpress/fight/fighter_vesna.cpp
+++ b/engines/lastexpress/fight/fighter_vesna.cpp
@@ -104,7 +104,7 @@ void FighterPlayerVesna::update() {
_opponent->handleAction(kFightAction3);
if (_opponent->getCountdown() <= 0) {
- getSoundQueue()->removeFromQueue(kEntityTables0);
+ getSoundQueue()->stop(kEntityTables0);
_fight->bailout(Fight::kFightEndWin);
return;
}
@@ -252,7 +252,7 @@ void FighterOpponentVesna::update() {
_opponent->update();
Fighter::update();
- getSoundQueue()->removeFromQueue(kEntityTables0);
+ getSoundQueue()->stop(kEntityTables0);
// Stop processing
return;
diff --git a/engines/lastexpress/game/action.cpp b/engines/lastexpress/game/action.cpp
index f623ed032e..d0ef92770e 100644
--- a/engines/lastexpress/game/action.cpp
+++ b/engines/lastexpress/game/action.cpp
@@ -1944,7 +1944,7 @@ void Action::playAnimation(EventIndex index, bool debugMode) const {
if (getGlobalTimer()) {
if (getSoundQueue()->isBuffered("TIMER")) {
- getSoundQueue()->processEntry("TIMER");
+ getSoundQueue()->fade("TIMER");
setGlobalTimer(105);
}
}
@@ -1962,7 +1962,7 @@ void Action::playAnimation(EventIndex index, bool debugMode) const {
animation.play();
if (getSoundQueue()->isBuffered("TIMER"))
- getSoundQueue()->removeFromQueue("TIMER");
+ getSoundQueue()->stop("TIMER");
}
// Show cursor
diff --git a/engines/lastexpress/game/entities.cpp b/engines/lastexpress/game/entities.cpp
index 059d2deb87..165319b782 100644
--- a/engines/lastexpress/game/entities.cpp
+++ b/engines/lastexpress/game/entities.cpp
@@ -296,7 +296,7 @@ void Entities::setupChapter(ChapterIndex chapter) {
memset(&_compartments1, 0, sizeof(_compartments1));
memset(&_positions, 0, sizeof(_positions));
- getSoundQueue()->resetQueue(kSoundType13);
+ getSoundQueue()->stopAllExcept(kSoundTagMenu);
}
// we skip the header when doing entity setup
@@ -367,7 +367,7 @@ void Entities::resetState(EntityIndex entityIndex) {
getData(entityIndex)->inventoryItem = kItemNone;
if (getSoundQueue()->isBuffered(entityIndex))
- getSoundQueue()->removeFromQueue(entityIndex);
+ getSoundQueue()->stop(entityIndex);
clearSequences(entityIndex);
diff --git a/engines/lastexpress/game/inventory.cpp b/engines/lastexpress/game/inventory.cpp
index 756ecda73f..f25463492b 100644
--- a/engines/lastexpress/game/inventory.cpp
+++ b/engines/lastexpress/game/inventory.cpp
@@ -165,7 +165,7 @@ void Inventory::handleMouseEvent(const Common::Event &ev) {
} else if (ev.type == Common::EVENT_RBUTTONDOWN && getGlobalTimer()) {
if (getSoundQueue()->isBuffered("TIMER"))
- getSoundQueue()->removeFromQueue("TIMER");
+ getSoundQueue()->stop("TIMER");
setGlobalTimer(900);
}
diff --git a/engines/lastexpress/game/logic.cpp b/engines/lastexpress/game/logic.cpp
index 7ba2b0ff85..9aad0308eb 100644
--- a/engines/lastexpress/game/logic.cpp
+++ b/engines/lastexpress/game/logic.cpp
@@ -420,7 +420,7 @@ void Logic::resetState() {
*/
void Logic::gameOver(SavegameType type, uint32 value, SceneIndex sceneIndex, bool showScene) const {
- getSoundQueue()->processEntries();
+ getSoundQueue()->endAmbient();
getEntities()->reset();
getFlags()->isGameRunning = false;
getSavePoints()->reset();
@@ -428,7 +428,7 @@ void Logic::gameOver(SavegameType type, uint32 value, SceneIndex sceneIndex, boo
if (showScene) {
- getSoundQueue()->processEntry(kSoundType11);
+ getSoundQueue()->fade(kSoundTagIntro);
if (sceneIndex && !getFlags()->mouseRightClick) {
getScenes()->loadScene(sceneIndex);
@@ -447,7 +447,7 @@ void Logic::gameOver(SavegameType type, uint32 value, SceneIndex sceneIndex, boo
}
void Logic::switchChapter() const {
- getSoundQueue()->clearStatus();
+ getSoundQueue()->stopAll();
switch(getState()->progress.chapter) {
default:
@@ -487,7 +487,7 @@ void Logic::switchChapter() const {
}
void Logic::playFinalSequence() const {
- getSoundQueue()->processEntries();
+ getSoundQueue()->endAmbient();
_action->playAnimation(kEventFinalSequence);
showCredits();
diff --git a/engines/lastexpress/game/savegame.cpp b/engines/lastexpress/game/savegame.cpp
index ce53e6eadf..8b45835fc7 100644
--- a/engines/lastexpress/game/savegame.cpp
+++ b/engines/lastexpress/game/savegame.cpp
@@ -509,7 +509,7 @@ void SaveLoad::loadLastGame() {
_gameTicksLastSavegame = getState()->timeTicks;
if (header.keepIndex) {
- getSoundQueue()->clearQueue();
+ getSoundQueue()->destroyAllSound();
readEntry(&type, &entity, &val, false);
}
diff --git a/engines/lastexpress/game/scenes.cpp b/engines/lastexpress/game/scenes.cpp
index 9aa85381ae..b68e5b0089 100644
--- a/engines/lastexpress/game/scenes.cpp
+++ b/engines/lastexpress/game/scenes.cpp
@@ -1064,7 +1064,7 @@ void SceneManager::preProcessScene(SceneIndex *index) {
Scene *newScene = getScenes()->get(*index);
if (getSoundQueue()->isBuffered(kEntityTables4)) {
if (newScene->type != Scene::kTypeReadText || newScene->param1)
- getSoundQueue()->processEntry(kEntityTables4);
+ getSoundQueue()->fade(kEntityTables4);
}
// Cleanup beetle sequences
@@ -1162,7 +1162,7 @@ void SceneManager::postProcessScene() {
if (getState()->time >= kTimeCityGalanta || getProgress().field_18 == 4)
break;
- getSoundQueue()->processEntry(kSoundType7);
+ getSoundQueue()->fade(kSoundTagLink);
getSound()->playSound(kEntityTrain, "LIB050", kVolumeFull);
switch (getProgress().chapter) {
diff --git a/engines/lastexpress/menu/menu.cpp b/engines/lastexpress/menu/menu.cpp
index 65680b3964..07fadc6817 100644
--- a/engines/lastexpress/menu/menu.cpp
+++ b/engines/lastexpress/menu/menu.cpp
@@ -349,10 +349,10 @@ void Menu::show(bool doSavegame, SavegameType type, uint32 value) {
init(doSavegame, type, value);
// Setup sound
- getSoundQueue()->resetQueue();
- getSoundQueue()->resetQueue(kSoundType11, kSoundType13);
+ getSoundQueue()->stopAmbient();
+ getSoundQueue()->stopAllExcept(kSoundTagIntro, kSoundTagMenu);
if (getSoundQueue()->isBuffered("TIMER"))
- getSoundQueue()->removeFromQueue("TIMER");
+ getSoundQueue()->stop("TIMER");
// Init flags & misc
_isShowingCredits = false;
@@ -412,7 +412,7 @@ bool Menu::handleEvent(StartMenuAction action, Common::EventType type) {
if (clicked) {
showFrame(kOverlayButtons, kButtonQuitPushed, true);
- getSoundQueue()->clearStatus();
+ getSoundQueue()->stopAll();
getSoundQueue()->updateQueue();
getSound()->playSound(kEntityPlayer, "LIB046");
@@ -485,7 +485,7 @@ bool Menu::handleEvent(StartMenuAction action, Common::EventType type) {
setLogicEventHandlers();
if (_index) {
- getSoundQueue()->processEntry(kSoundType11);
+ getSoundQueue()->fade(kSoundTagIntro);
} else {
if (!getFlags()->mouseRightClick) {
getScenes()->loadScene((SceneIndex)(5 * _gameId + 3));
@@ -497,7 +497,7 @@ bool Menu::handleEvent(StartMenuAction action, Common::EventType type) {
getScenes()->loadScene((SceneIndex)(5 * _gameId + 5));
if (!getFlags()->mouseRightClick) {
- getSoundQueue()->processEntry(kSoundType11);
+ getSoundQueue()->fade(kSoundTagIntro);
// Show intro
Animation animation;
@@ -513,7 +513,7 @@ bool Menu::handleEvent(StartMenuAction action, Common::EventType type) {
if (!getEvent(kEventIntro)) {
getEvent(kEventIntro) = 1;
- getSoundQueue()->processEntry(kSoundType11);
+ getSoundQueue()->fade(kSoundTagIntro);
}
}
@@ -1119,7 +1119,7 @@ void Menu::updateTime(uint32 time) {
if (_time != time) {
if (getSoundQueue()->isBuffered(kEntityChapters))
- getSoundQueue()->removeFromQueue(kEntityChapters);
+ getSoundQueue()->stop(kEntityChapters);
getSound()->playSoundWithSubtitles((_currentTime >= _time) ? "LIB042" : "LIB041", kSoundTypeMenu | kSoundFlagFixedVolume | kVolumeFull, kEntityChapters);
adjustIndex(_currentTime, _time, false);
@@ -1251,7 +1251,7 @@ void Menu::adjustTime() {
}
if (_currentTime == _time && getSoundQueue()->isBuffered(kEntityChapters))
- getSoundQueue()->removeFromQueue(kEntityChapters);
+ getSoundQueue()->stop(kEntityChapters);
_clock->draw(_time);
_trainLine->draw(_time);
diff --git a/engines/lastexpress/shared.h b/engines/lastexpress/shared.h
index c55829120d..a401e31006 100644
--- a/engines/lastexpress/shared.h
+++ b/engines/lastexpress/shared.h
@@ -31,24 +31,27 @@ namespace LastExpress {
// Sound
//////////////////////////////////////////////////////////////////////////
-enum SoundType {
- kSoundTypeNone = 0,
- kSoundType1,
- kSoundType2,
- kSoundType3,
- kSoundType4,
- kSoundType5,
- kSoundType6,
- kSoundType7,
- kSoundType8,
- kSoundType9,
- kSoundType10,
- kSoundType11,
- kSoundType12,
- kSoundType13,
- kSoundType14,
- kSoundType15,
- kSoundType16
+enum SoundTag {
+ kSoundTagNone = 0,
+ kSoundTagAmbient = 1,
+ kSoundTagOldAmbient = 2,
+ kSoundTagWalla = 3,
+ kSoundTagOldWalla = 4,
+ kSoundTagConcert = 5,
+ // 6 is unused
+ kSoundTagLink = 7,
+ kSoundTagOldLink = 8,
+ kSoundTagNIS = 9,
+ kSoundTagOldNIS = 10,
+ kSoundTagIntro = 11,
+ // 12 is unused
+ kSoundTagMenu = 13,
+ kSoundTagOldMenu = 14,
+ kSoundTagCredits = 15,
+ kSoundTagFirstNormal = 16
+ // every normal sound gets its own tag from an incrementing counter
+ // initialized as kSoundTagFirstNormal,
+ // so tags can have values not covered by this enum
};
/*
@@ -158,10 +161,9 @@ enum SoundFlag {
kSoundFlagUnmuteRequested = 0x80000000 // purely informational
};
-enum SoundState {
- kSoundStateNone = 0,
- kSoundState1 = 1,
- kSoundState2 = 2
+enum AmbientSoundState {
+ kAmbientSoundEnabled = 1,
+ kAmbientSoundSteam = 2
};
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/lastexpress/sound/entry.cpp b/engines/lastexpress/sound/entry.cpp
index 0eb6077d78..8d9a496fe1 100644
--- a/engines/lastexpress/sound/entry.cpp
+++ b/engines/lastexpress/sound/entry.cpp
@@ -43,16 +43,12 @@ namespace LastExpress {
//////////////////////////////////////////////////////////////////////////
SoundEntry::SoundEntry(LastExpressEngine *engine) : _engine(engine) {
_status = 0;
- _type = kSoundTypeNone;
-
- _currentDataPtr = NULL;
+ _tag = kSoundTagNone;
_blockCount = 0;
_stream = NULL;
- _field_34 = 0;
- _field_38 = 0;
_volumeWithoutNIS = 0;
_entity = kEntityPlayer;
_initTimeMS = 0;
@@ -71,8 +67,6 @@ SoundEntry::~SoundEntry() {
SAFE_DELETE(_soundStream);
- free(_currentDataPtr);
-
_subtitle = NULL;
_stream = NULL;
@@ -82,7 +76,7 @@ SoundEntry::~SoundEntry() {
void SoundEntry::open(Common::String name, SoundFlag flag, int priority) {
_priority = priority;
- setType(flag);
+ setupTag(flag);
setupStatus(flag);
loadStream(name);
}
@@ -100,13 +94,13 @@ void SoundEntry::close() {
// removeFromCache(entry);
if (_subtitle) {
- _subtitle->draw();
+ _subtitle->close();
SAFE_DELETE(_subtitle);
}
if (_entity) {
if (_entity == kEntitySteam)
- getSound()->playLoopingSound(2);
+ getSound()->playAmbientSound(2);
else if (_entity != kEntityTrain)
getSavePoints()->push(kEntityPlayer, _entity, kActionEndSound);
}
@@ -137,73 +131,72 @@ bool SoundEntry::isFinished() {
return _soundStream->isFinished();
}
-void SoundEntry::setType(SoundFlag flag) {
+void SoundEntry::setupTag(SoundFlag flag) {
switch (flag & kSoundTypeMask) {
default:
case kSoundTypeNormal:
- _type = getSoundQueue()->getCurrentType();
- getSoundQueue()->setCurrentType((SoundType)(_type + 1));
+ _tag = getSoundQueue()->generateNextTag();
break;
case kSoundTypeAmbient: {
- SoundEntry *previous2 = getSoundQueue()->getEntry(kSoundType2);
+ SoundEntry *previous2 = getSoundQueue()->getEntry(kSoundTagOldAmbient);
if (previous2)
previous2->fade();
- SoundEntry *previous = getSoundQueue()->getEntry(kSoundType1);
+ SoundEntry *previous = getSoundQueue()->getEntry(kSoundTagAmbient);
if (previous) {
- previous->setType(kSoundType2);
+ previous->_tag = kSoundTagOldAmbient;
previous->fade();
}
- _type = kSoundType1;
+ _tag = kSoundTagAmbient;
}
break;
case kSoundTypeWalla: {
- SoundEntry *previous = getSoundQueue()->getEntry(kSoundType3);
+ SoundEntry *previous = getSoundQueue()->getEntry(kSoundTagWalla);
if (previous) {
- previous->setType(kSoundType4);
+ previous->_tag = kSoundTagOldWalla;
previous->fade();
}
- _type = kSoundType11;
+ _tag = kSoundTagIntro;
}
break;
case kSoundTypeLink: {
- SoundEntry *previous = getSoundQueue()->getEntry(kSoundType7);
+ SoundEntry *previous = getSoundQueue()->getEntry(kSoundTagLink);
if (previous)
- previous->setType(kSoundType8);
+ previous->_tag = kSoundTagOldLink;
- _type = kSoundType7;
+ _tag = kSoundTagLink;
}
break;
case kSoundTypeNIS: {
- SoundEntry *previous = getSoundQueue()->getEntry(kSoundType9);
+ SoundEntry *previous = getSoundQueue()->getEntry(kSoundTagNIS);
if (previous)
- previous->setType(kSoundType10);
+ previous->_tag = kSoundTagOldNIS;
- _type = kSoundType9;
+ _tag = kSoundTagNIS;
}
break;
case kSoundTypeIntro: {
- SoundEntry *previous = getSoundQueue()->getEntry(kSoundType11);
+ SoundEntry *previous = getSoundQueue()->getEntry(kSoundTagIntro);
if (previous)
- previous->setType(kSoundType14);
+ previous->_tag = kSoundTagOldMenu;
- _type = kSoundType11;
+ _tag = kSoundTagIntro;
}
break;
case kSoundTypeMenu: {
- SoundEntry *previous = getSoundQueue()->getEntry(kSoundType13);
+ SoundEntry *previous = getSoundQueue()->getEntry(kSoundTagMenu);
if (previous)
- previous->setType(kSoundType14);
+ previous->_tag = kSoundTagOldMenu;
- _type = kSoundType13;
+ _tag = kSoundTagMenu;
}
break;
}
@@ -219,7 +212,7 @@ void SoundEntry::setupStatus(SoundFlag flag) {
}
void SoundEntry::loadStream(Common::String name) {
- _name2 = name;
+ _name = name;
// Load sound data
_stream = getArchive(name);
@@ -252,8 +245,8 @@ void SoundEntry::setVolumeSmoothly(SoundFlag newVolume) {
_soundStream->setVolumeSmoothly(requestedVolume);
}
-bool SoundEntry::updateSound() {
- assert(_name2.size() < 16);
+bool SoundEntry::update() {
+ assert(_name.size() < 16);
bool result;
char sub[16];
@@ -268,8 +261,8 @@ bool SoundEntry::updateSound() {
play();
// drop .SND extension
- strcpy(sub, _name2.c_str());
- int l = _name2.size();
+ strcpy(sub, _name.c_str());
+ int l = _name.size();
if (l > 4)
sub[l - 4] = 0;
showSubtitle(sub);
@@ -297,7 +290,7 @@ void SoundEntry::setVolume(SoundFlag newVolume) {
assert((newVolume & kSoundVolumeMask) == newVolume);
if (newVolume) {
- if (getSoundQueue()->getFlag() & 0x20 && _type != kSoundType9 && _type != kSoundType7)
+ if (getSoundQueue()->getFlag() & 0x20 && _tag != kSoundTagNIS && _tag != kSoundTagLink)
setVolumeSmoothly(newVolume);
else
_status = newVolume + (_status & ~kSoundVolumeMask);
@@ -312,7 +305,7 @@ void SoundEntry::setVolume(SoundFlag newVolume) {
void SoundEntry::adjustVolumeIfNISPlaying() {
if (getSoundQueue()->getFlag() & 32) {
- if (_type != kSoundType9 && _type != kSoundType7 && _type != kSoundType5) {
+ if (_tag != kSoundTagNIS && _tag != kSoundTagLink && _tag != kSoundTagConcert) {
uint32 baseVolume = _status & kSoundVolumeMask;
uint32 actualVolume = baseVolume / 2 + 1;
@@ -331,7 +324,7 @@ void SoundEntry::initDelayedActivate(unsigned activateDelay) {
_status |= kSoundFlagDelayedActivate;
}
-void SoundEntry::reset() {
+void SoundEntry::kill() {
_status |= kSoundFlagClosed;
_entity = kEntityPlayer;
@@ -353,7 +346,7 @@ void SoundEntry::showSubtitle(Common::String filename) {
_subtitle->load(filename, this);
if (_subtitle->getStatus() & 0x400) {
- _subtitle->draw();
+ _subtitle->close();
SAFE_DELETE(_subtitle);
} else {
_status |= kSoundFlagHasSubtitles;
@@ -361,17 +354,17 @@ void SoundEntry::showSubtitle(Common::String filename) {
}
void SoundEntry::saveLoadWithSerializer(Common::Serializer &s) {
- assert(_name1.size() <= 16);
- assert(_name2.size() <= 16);
+ assert(_name.size() <= 16);
- if (_name2.matchString("NISSND?") && ((_status & kSoundTypeMask) != kSoundTypeMenu)) {
+ if (_name.matchString("NISSND?") && ((_status & kSoundTypeMask) != kSoundTypeMenu)) {
s.syncAsUint32LE(_status);
- s.syncAsUint32LE(_type);
+ s.syncAsUint32LE(_tag);
s.syncAsUint32LE(_blockCount); // field_8;
uint32 time = getTime();
s.syncAsUint32LE(time);
- s.syncAsUint32LE(_field_34); // field_10;
- s.syncAsUint32LE(_field_38); // field_14;
+ uint32 unused = 0;
+ s.syncAsUint32LE(unused);
+ s.syncAsUint32LE(unused);
s.syncAsUint32LE(_entity);
if (s.isLoading()) {
@@ -389,13 +382,11 @@ void SoundEntry::saveLoadWithSerializer(Common::Serializer &s) {
s.syncAsUint32LE(_priority);
- char name1[16];
- strcpy((char *)&name1, _name1.c_str());
- s.syncBytes((byte *)&name1, 16);
+ char name[16] = {0};
+ s.syncBytes((byte *)name, 16);
- char name2[16];
- strcpy((char *)&name2, _name2.c_str());
- s.syncBytes((byte *)&name2, 16);
+ strcpy((char *)name, _name.c_str());
+ s.syncBytes((byte *)name, 16);
}
}
@@ -466,7 +457,7 @@ void SubtitleEntry::setupAndDraw() {
// TODO Missing code
}
-void SubtitleEntry::draw() {
+void SubtitleEntry::close() {
// Remove ourselves from the queue
getSoundQueue()->removeSubtitle(this);
diff --git a/engines/lastexpress/sound/entry.h b/engines/lastexpress/sound/entry.h
index 48e802ed9a..cb12214d4a 100644
--- a/engines/lastexpress/sound/entry.h
+++ b/engines/lastexpress/sound/entry.h
@@ -26,32 +26,38 @@
/*
Sound entry: 68 bytes (this is what appears in savegames)
uint32 {4} - status
- uint32 {4} - type
- uint32 {4} - blockCount
- uint32 {4} - time
+ uint32 {4} - tag
+ uint32 {4} - time left (_blockCount - _time)
+ uint32 {4} - time in sound ticks (30Hz timer)
uint32 {4} - LastExpress_ADPCMStream::_volumeHoldBlocks
(useless since the target volume is not saved)
- uint32 {4} - ?? [copy of a field below with no references]
+ uint32 {4} - ?? [no references except for save/load]
uint32 {4} - entity
uint32 {4} - activate delay in sound ticks (30Hz timer)
uint32 {4} - priority
- char {16} - name 1
- char {16} - name 2
+ char {16} - name of linked-after sound
+ (always empty because only NIS entries
+ have linked-after sounds, and NIS entries are not saved)
+ char {16} - name
Sound queue entry: 120 bytes
- uint16 {2} - status
- byte {1} - type
- byte {1} - ??
- uint32 {4} - ??
- uint32 {4} - currentDataPtr
- uint32 {4} - soundData
- uint32 {4} - currentBufferPtr
- uint32 {4} - blockCount
- uint32 {4} - time
- uint32 {4} - size
- uint32 {4} - ??
+ uint32 {4} - status (combination of flags from SoundFlag)
+ uint32 {4} - tag (enum SoundTag for special sounds,
+ unique value for normal ones)
+ uint32 {4} - pointer to the beginning of the buffer for compressed sound data
+ uint32 {4} - pointer to the end of the buffer for compressed sound data
+ uint32 {4} - decoder pointer inside the buffer
+ uint32 {4} - pointer to the sound buffer [always same as the third field]
+ uint32 {4} - reader pointer inside the buffer
+ uint32 {4} - time left (_blockCount - time)
+ uint32 {4} - time in sound ticks (30Hz timer)
+ uint32 {4} - buffer size
+ uint32 {4} - union:
+ if data stream is open: position in the stream
+ if data stream is closed: close reason, purely informational
uint32 {4} - archive structure pointer
- uint32 {4} - ??
+ uint32 {4} - _linkAfter, pointer to the entry for linked-after sound
+ (xxx.LNK for sound entry corresponding to xxx.NIS)
uint32 {4} - LastExpress_ADPCMStream::_volumeHoldBlocks
(used for smooth change of volume)
uint32 {4} - ?? [no references except for save/load]
@@ -62,8 +68,8 @@
uint32 {4} - entity
uint32 {4} - activate time in sound ticks (30Hz timer)
uint32 {4} - priority
- char {16} - name 1
- char {16} - name 2
+ char {16} - name of linked-after sound, used to save/load _linkAfter
+ char {16} - name
uint32 {4} - pointer to next entry in the queue
uint32 {4} - subtitle data pointer
*/
@@ -91,13 +97,13 @@ public:
void open(Common::String name, SoundFlag flag, int priority);
void close();
void play();
- void reset();
+ void kill();
bool isFinished();
void setVolumeSmoothly(SoundFlag newVolume);
// setVolumeSmoothly() treats kVolumeNone in a special way;
// fade() terminates the stream after the transition
void fade() { setVolumeSmoothly(kVolumeNone); }
- bool updateSound();
+ bool update();
void adjustVolumeIfNISPlaying();
void setVolume(SoundFlag newVolume);
// activateDelay is measured in main ticks, 15Hz timer
@@ -111,15 +117,14 @@ public:
// Accessors
void addStatusFlag(SoundFlag flag) { _status |= flag; }
- void setType(SoundType type) { _type = type; }
void setEntity(EntityIndex entity) { _entity = entity; }
uint32 getStatus() { return _status; }
- SoundType getType() { return _type; }
+ int32 getTag() { return _tag; }
uint32 getTime() { return _soundStream ? (_soundStream->getTimeMS() * 30 / 1000) : 0; }
EntityIndex getEntity() { return _entity; }
uint32 getPriority() { return _priority; }
- Common::String getName2() { return _name2; }
+ const Common::String& getName(){ return _name; }
// Streams
SimpleSound *getSoundStream() { return _soundStream; }
@@ -131,19 +136,19 @@ private:
// _status = (SoundFlag)(_status | kSoundFlagXxx) instead of _status |= kSoundFlagXxx
// is irksome, so let's keep the type as uint32
uint32 _status;
- SoundType _type; // int
- //int _data;
- //int _endOffset;
- byte * _currentDataPtr;
- //int _currentBufferPtr;
- int _blockCount;
- //int _size;
- //int _field_28;
+ int32 _tag; // member of SoundTag for special sounds, unique value for normal sounds
+ //byte *_bufferStart, *_bufferEnd, *_decodePointer, *_buffer, *_readPointer;
+ // the original game uses uint32 _blocksLeft, _time instead of _totalBlocks
+ // we ask the backend for sound time
+ uint32 _blockCount;
+ //uint32 _bufferSize;
+ //union { uint32 _streamPos; enum StreamCloseReason _streamCloseReason; };
Common::SeekableReadStream *_stream; // The file stream
- //int _archive;
- int _field_34;
- int _field_38;
- int _volumeWithoutNIS;
+ //SoundEntry* _linkAfter;
+ //uint32 _volumeHoldBlocks; // the related logic is in LastExpress_ADPCMStream
+ //uint32 _unused;
+ //uint32 _smoothChangeTarget; // the related logic is in LastExpress_ADPCMStream
+ uint32 _volumeWithoutNIS;
EntityIndex _entity;
// The original game uses one variable _activateTime = _initTime + _activateDelay
// and measures everything in sound ticks (30Hz timer).
@@ -151,15 +156,15 @@ private:
// (probably paranoid, but nothing really complicated).
uint32 _initTimeMS, _activateDelayMS;
uint32 _priority;
- Common::String _name1; //char[16];
- Common::String _name2; //char[16];
+ // char _linkAfterName[16];
+ Common::String _name; //char[16];
// original has pointer to the next structure in the list (not used)
SubtitleEntry *_subtitle;
// Sound buffer & stream
StreamedSound *_soundStream; // the filtered sound stream
- void setType(SoundFlag flag);
+ void setupTag(SoundFlag flag);
void setupStatus(SoundFlag flag);
void loadStream(Common::String name);
};
@@ -174,7 +179,7 @@ public:
void load(Common::String filename, SoundEntry *soundEntry);
void loadData();
- void draw();
+ void close();
void setupAndDraw();
void drawOnScreen();
diff --git a/engines/lastexpress/sound/queue.cpp b/engines/lastexpress/sound/queue.cpp
index 8eef091f51..e162174ab2 100644
--- a/engines/lastexpress/sound/queue.cpp
+++ b/engines/lastexpress/sound/queue.cpp
@@ -34,8 +34,8 @@
namespace LastExpress {
SoundQueue::SoundQueue(LastExpressEngine *engine) : _engine(engine) {
- _state = 0;
- _currentType = kSoundType16;
+ _ambientState = 0;
+ _currentTag = kSoundTagFirstNormal;
_flag = 0;
_subtitlesFlag = 0;
@@ -66,25 +66,25 @@ void SoundQueue::addToQueue(SoundEntry *entry) {
_soundList.push_back(entry);
}
-void SoundQueue::removeFromQueue(EntityIndex entity) {
+void SoundQueue::stop(EntityIndex entity) {
SoundEntry *entry = getEntry(entity);
if (entry)
- entry->reset();
+ entry->kill();
}
-void SoundQueue::removeFromQueue(Common::String filename) {
+void SoundQueue::stop(Common::String filename) {
SoundEntry *entry = getEntry(filename);
if (entry)
- entry->reset();
+ entry->kill();
}
void SoundQueue::updateQueue() {
++_flag;
- if (getSoundState() & kSoundState1) {
- SoundEntry *entry = getEntry(kSoundType1);
- if (!entry || getFlags()->flag_3 || (entry && entry->getTime() > getSound()->getLoopingSoundDuration())) {
- getSound()->playLoopingSound(0x45);
+ if (getAmbientState() & kAmbientSoundEnabled) {
+ SoundEntry *entry = getEntry(kSoundTagAmbient);
+ if (!entry || getFlags()->flag_3 || (entry && entry->getTime() > getSound()->getAmbientSoundDuration())) {
+ getSound()->playAmbientSound(0x45);
} else {
if (getSound()->getData1() && getSound()->getData2() >= getSound()->getData1()) {
entry->setVolumeSmoothly((SoundFlag)getSound()->getData0());
@@ -102,7 +102,7 @@ void SoundQueue::updateQueue() {
// and if the sound data buffer is not full, loads a new entry to be played based on
// its priority and filter id
- if (!entry->updateSound() && !(entry->getStatus() & kSoundFlagKeepAfterFinish)) {
+ if (!entry->update() && !(entry->getStatus() & kSoundFlagKeepAfterFinish)) {
entry->close();
SAFE_DELETE(entry);
it = _soundList.reverse_erase(it);
@@ -125,39 +125,39 @@ void SoundQueue::updateQueue() {
--_flag;
}
-void SoundQueue::resetQueue() {
+void SoundQueue::stopAmbient() {
for (Common::List<SoundEntry *>::iterator i = _soundList.begin(); i != _soundList.end(); ++i) {
- if ((*i)->getType() == kSoundType1) {
- (*i)->reset();
+ if ((*i)->getTag() == kSoundTagAmbient) {
+ (*i)->kill();
break;
}
}
for (Common::List<SoundEntry *>::iterator i = _soundList.begin(); i != _soundList.end(); ++i) {
- if ((*i)->getType() == kSoundType2) {
- (*i)->reset();
+ if ((*i)->getTag() == kSoundTagOldAmbient) {
+ (*i)->kill();
break;
}
}
}
-void SoundQueue::resetQueue(SoundType type1, SoundType type2) {
+void SoundQueue::stopAllExcept(SoundTag type1, SoundTag type2) {
if (!type2)
type2 = type1;
for (Common::List<SoundEntry *>::iterator i = _soundList.begin(); i != _soundList.end(); ++i) {
- if ((*i)->getType() != type1 && (*i)->getType() != type2)
- (*i)->reset();
+ if ((*i)->getTag() != type1 && (*i)->getTag() != type2)
+ (*i)->kill();
}
}
-void SoundQueue::clearQueue() {
+void SoundQueue::destroyAllSound() {
_flag |= 8;
for (Common::List<SoundEntry *>::iterator i = _soundList.begin(); i != _soundList.end(); ++i) {
SoundEntry *entry = (*i);
if (entry == NULL)
- error("[SoundQueue::clearQueue] Invalid entry found in sound queue");
+ error("[SoundQueue::destroyAllSound] Invalid entry found in sound queue");
// Delete entry
entry->close();
@@ -172,7 +172,7 @@ void SoundQueue::clearQueue() {
//////////////////////////////////////////////////////////////////////////
// State
//////////////////////////////////////////////////////////////////////////
-void SoundQueue::clearStatus() {
+void SoundQueue::stopAll() {
for (Common::List<SoundEntry *>::iterator i = _soundList.begin(); i != _soundList.end(); ++i)
(*i)->addStatusFlag(kSoundFlagClosed);
}
@@ -180,13 +180,13 @@ void SoundQueue::clearStatus() {
//////////////////////////////////////////////////////////////////////////
// Entry management
//////////////////////////////////////////////////////////////////////////
-void SoundQueue::setupEntry(SoundType type, EntityIndex index) {
- SoundEntry *entry = getEntry(type);
+void SoundQueue::assignNISLink(EntityIndex index) {
+ SoundEntry *entry = getEntry(kSoundTagLink);
if (entry)
entry->setEntity(index);
}
-void SoundQueue::processEntry(EntityIndex entity) {
+void SoundQueue::fade(EntityIndex entity) {
SoundEntry *entry = getEntry(entity);
if (entry) {
entry->fade();
@@ -194,13 +194,13 @@ void SoundQueue::processEntry(EntityIndex entity) {
}
}
-void SoundQueue::processEntry(SoundType type) {
+void SoundQueue::fade(SoundTag type) {
SoundEntry *entry = getEntry(type);
if (entry)
entry->fade();
}
-void SoundQueue::processEntry(Common::String filename) {
+void SoundQueue::fade(Common::String filename) {
SoundEntry *entry = getEntry(filename);
if (entry) {
entry->fade();
@@ -208,11 +208,11 @@ void SoundQueue::processEntry(Common::String filename) {
}
}
-void SoundQueue::processEntries() {
- _state = 0;
+void SoundQueue::endAmbient() {
+ _ambientState = 0;
- processEntry(kSoundType1);
- processEntry(kSoundType2);
+ fade(kSoundTagAmbient);
+ fade(kSoundTagOldAmbient);
}
SoundEntry *SoundQueue::getEntry(EntityIndex index) {
@@ -229,16 +229,16 @@ SoundEntry *SoundQueue::getEntry(Common::String name) {
name += ".SND";
for (Common::List<SoundEntry *>::iterator i = _soundList.begin(); i != _soundList.end(); ++i) {
- if ((*i)->getName2() == name)
+ if ((*i)->getName() == name)
return *i;
}
return NULL;
}
-SoundEntry *SoundQueue::getEntry(SoundType type) {
+SoundEntry *SoundQueue::getEntry(SoundTag type) {
for (Common::List<SoundEntry *>::iterator i = _soundList.begin(); i != _soundList.end(); ++i) {
- if ((*i)->getType() == type)
+ if ((*i)->getTag() == type)
return *i;
}
@@ -318,8 +318,8 @@ void SoundQueue::updateSubtitles() {
// Savegame
//////////////////////////////////////////////////////////////////////////
void SoundQueue::saveLoadWithSerializer(Common::Serializer &s) {
- s.syncAsUint32LE(_state);
- s.syncAsUint32LE(_currentType);
+ s.syncAsUint32LE(_ambientState);
+ s.syncAsUint32LE(_currentTag);
// Compute the number of entries to save
uint32 numEntries = count();
@@ -347,7 +347,7 @@ void SoundQueue::saveLoadWithSerializer(Common::Serializer &s) {
uint32 SoundQueue::count() {
uint32 numEntries = 0;
for (Common::List<SoundEntry *>::iterator i = _soundList.begin(); i != _soundList.end(); ++i)
- if ((*i)->getName2().matchString("NISSND?"))
+ if ((*i)->getName().matchString("NISSND?"))
++numEntries;
return numEntries;
diff --git a/engines/lastexpress/sound/queue.h b/engines/lastexpress/sound/queue.h
index 1c73f57906..df8c945ee9 100644
--- a/engines/lastexpress/sound/queue.h
+++ b/engines/lastexpress/sound/queue.h
@@ -42,26 +42,26 @@ public:
// Queue
void addToQueue(SoundEntry *entry);
- void removeFromQueue(Common::String filename);
- void removeFromQueue(EntityIndex entity);
+ void stop(Common::String filename);
+ void stop(EntityIndex entity);
void updateQueue();
- void resetQueue();
- void resetQueue(SoundType type1, SoundType type2 = kSoundTypeNone);
- void clearQueue();
+ void stopAmbient();
+ void stopAllExcept(SoundTag type1, SoundTag type2 = kSoundTagNone);
+ void destroyAllSound();
// State
- void clearStatus();
- int getSoundState() { return _state; }
- void resetState() { resetState(kSoundState1); }
- void resetState(SoundState state) { _state |= state; }
+ void stopAll();
+ int getAmbientState() { return _ambientState; }
+ void startAmbient() { _ambientState |= kAmbientSoundEnabled; }
+ void setAmbientToSteam() { _ambientState |= kAmbientSoundSteam; }
// Entries
- void setupEntry(SoundType type, EntityIndex index);
- void processEntry(EntityIndex entity);
- void processEntry(SoundType type);
- void processEntry(Common::String filename);
- void processEntries();
- SoundEntry *getEntry(SoundType type);
+ void assignNISLink(EntityIndex index);
+ void fade(EntityIndex entity);
+ void fade(SoundTag type);
+ void fade(Common::String filename);
+ void endAmbient();
+ SoundEntry *getEntry(SoundTag type);
SoundEntry *getEntry(EntityIndex index);
SoundEntry *getEntry(Common::String name);
uint32 getEntryTime(EntityIndex index);
@@ -83,8 +83,8 @@ public:
uint32 getFlag() { return _flag; }
int getSubtitleFlag() { return _subtitlesFlag; }
void setSubtitleFlag(int flag) { _subtitlesFlag = flag; }
- SoundType getCurrentType() { return _currentType; }
- void setCurrentType(SoundType type) { _currentType = type; }
+
+ int32 generateNextTag() { return _currentTag++; }
protected:
// Debug
@@ -94,8 +94,8 @@ private:
LastExpressEngine *_engine;
// State & shared data
- int _state;
- SoundType _currentType;
+ int _ambientState;
+ int32 _currentTag;
// TODO: this seems to be a synchronization flag for the sound timer
uint32 _flag;
diff --git a/engines/lastexpress/sound/sound.cpp b/engines/lastexpress/sound/sound.cpp
index b69121bbb5..c28b734129 100644
--- a/engines/lastexpress/sound/sound.cpp
+++ b/engines/lastexpress/sound/sound.cpp
@@ -113,7 +113,7 @@ static const SoundFlag soundFlags[32] = {
};
SoundManager::SoundManager(LastExpressEngine *engine) : _engine(engine) {
- _loopingSoundDuration = 0;
+ _ambientSoundDuration = 0;
_queue = new SoundQueue(engine);
@@ -137,7 +137,7 @@ SoundManager::~SoundManager() {
//////////////////////////////////////////////////////////////////////////
void SoundManager::playSound(EntityIndex entity, Common::String filename, SoundFlag flag, byte activateDelay) {
if (_queue->isBuffered(entity) && entity && entity < kEntityTrain)
- _queue->removeFromQueue(entity);
+ _queue->stop(entity);
SoundFlag currentFlag = (flag == kSoundVolumeEntityDefault) ? getSoundFlag(entity) : (SoundFlag)(flag | 0x80000);
@@ -178,7 +178,7 @@ bool SoundManager::playSoundWithSubtitles(Common::String filename, uint32 flag,
// Add entry to sound list
_queue->addToQueue(entry);
- return (entry->getType() != kSoundTypeNone);
+ return (entry->getTag() != kSoundTagNone);
}
void SoundManager::playSoundEvent(EntityIndex entity, byte action, byte activateDelay) {
@@ -311,13 +311,13 @@ void SoundManager::playSteam(CityIndex index) {
if (index >= ARRAYSIZE(cities))
error("[SoundManager::playSteam] Invalid city index (was %d, max %d)", index, ARRAYSIZE(cities));
- _queue->resetState(kSoundState2);
+ _queue->setAmbientToSteam();
- if (!_queue->getEntry(kSoundType1))
+ if (!_queue->getEntry(kSoundTagAmbient))
playSoundWithSubtitles("STEAM.SND", kSoundTypeAmbient | kSoundFlagLooped | kVolume7, kEntitySteam);
// Get the new sound entry and show subtitles
- SoundEntry *entry = _queue->getEntry(kSoundType1);
+ SoundEntry *entry = _queue->getEntry(kSoundTagAmbient);
if (entry)
entry->showSubtitle(cities[index]);
}
@@ -368,7 +368,7 @@ void SoundManager::playFightSound(byte action, byte a4) {
void SoundManager::playDialog(EntityIndex entity, EntityIndex entityDialog, SoundFlag flag, byte a4) {
if (_queue->isBuffered(getDialogName(entityDialog)))
- _queue->removeFromQueue(getDialogName(entityDialog));
+ _queue->stop(getDialogName(entityDialog));
playSound(entity, getDialogName(entityDialog), flag, a4);
}
@@ -695,7 +695,7 @@ void SoundManager::readText(int id) {
// Check if file is in cache for id [1;8]
if (id <= 8)
if (_queue->isBuffered(text))
- _queue->removeFromQueue(text);
+ _queue->stop(text);
playSound(kEntityTables4, text, kVolumeFull);
}
@@ -1293,8 +1293,8 @@ SoundFlag SoundManager::getSoundFlag(EntityIndex entity) const {
//////////////////////////////////////////////////////////////////////////
// Misc
//////////////////////////////////////////////////////////////////////////
-void SoundManager::playLoopingSound(int param) {
- SoundEntry *entry = _queue->getEntry(kSoundType1);
+void SoundManager::playAmbientSound(int param) {
+ SoundEntry *entry = _queue->getEntry(kSoundTagAmbient);
static const EntityPosition positions[8] = { kPosition_8200, kPosition_7500,
kPosition_6470, kPosition_5790,
@@ -1315,11 +1315,11 @@ void SoundManager::playLoopingSound(int param) {
int partNumber = 1;
int fnameLen = 6;
- if (_queue->getSoundState() & kSoundState1 && param >= 0x45 && param <= 0x46) {
- if (_queue->getSoundState() & kSoundState2) {
+ if (_queue->getAmbientState() & kAmbientSoundEnabled && param >= 0x45 && param <= 0x46) {
+ if (_queue->getAmbientState() & kAmbientSoundSteam) {
strcpy(tmp, "STEAM.SND");
- _loopingSoundDuration = 32767;
+ _ambientSoundDuration = 32767;
} else {
if (getEntityData(kEntityPlayer)->location == kLocationOutsideTrain) {
partNumber = 6;
@@ -1373,8 +1373,8 @@ void SoundManager::playLoopingSound(int param) {
if (getFlags()->flag_3)
fnameLen = 5;
- if (!entry || scumm_strnicmp(entry->getName2().c_str(), tmp, (uint)fnameLen)) {
- _loopingSoundDuration = _engine->getRandom().getRandomNumber(319) + 260;
+ if (!entry || scumm_strnicmp(entry->getName().c_str(), tmp, (uint)fnameLen)) {
+ _ambientSoundDuration = _engine->getRandom().getRandomNumber(319) + 260;
if (partNumber != 99) {
playSoundWithSubtitles(tmp, kSoundTypeAmbient | kSoundFlagLooped | kVolume1, kEntitySteam);
@@ -1382,7 +1382,7 @@ void SoundManager::playLoopingSound(int param) {
if (entry)
entry->fade();
- SoundEntry *entry1 = _queue->getEntry(kSoundType1);
+ SoundEntry *entry1 = _queue->getEntry(kSoundTagAmbient);
if (entry1)
entry1->setVolumeSmoothly(kVolume7);
}
diff --git a/engines/lastexpress/sound/sound.h b/engines/lastexpress/sound/sound.h
index fad0e6dad9..f832574ba5 100644
--- a/engines/lastexpress/sound/sound.h
+++ b/engines/lastexpress/sound/sound.h
@@ -47,7 +47,7 @@ public:
void playFightSound(byte action, byte a4);
void playLocomotiveSound();
void playWarningCompartment(EntityIndex entity, ObjectIndex compartment);
- void playLoopingSound(int param);
+ void playAmbientSound(int param);
// Dialog & Letters
void readText(int id);
@@ -68,7 +68,7 @@ public:
uint32 getData0() { return _data0; }
int32 getData1() { return _data1; }
int32 getData2() { return _data2; }
- uint32 getLoopingSoundDuration() { return _loopingSoundDuration; }
+ uint32 getAmbientSoundDuration() { return _ambientSoundDuration; }
// Setters
void setData1(int32 data) { _data1 = data; }
@@ -81,7 +81,7 @@ private:
uint32 _lastWarning[12];
// Looping sound
- int _loopingSoundDuration;
+ int _ambientSoundDuration;
// Unknown data
uint32 _data0;