aboutsummaryrefslogtreecommitdiff
path: root/engines/lastexpress
diff options
context:
space:
mode:
authorEvgeny Grechnikov2018-10-14 20:05:54 +0300
committerEvgeny Grechnikov2018-10-14 20:08:32 +0300
commit53cd6616c958e4a50644254688aea222177f2ae2 (patch)
treeb0373918c84cf577268056ef0fe65a97f19f7e58 /engines/lastexpress
parent46fe0aafd6996841ee9969da7a8988497baf51b6 (diff)
downloadscummvm-rg350-53cd6616c958e4a50644254688aea222177f2ae2.tar.gz
scummvm-rg350-53cd6616c958e4a50644254688aea222177f2ae2.tar.bz2
scummvm-rg350-53cd6616c958e4a50644254688aea222177f2ae2.zip
LASTEXPRESS: refactor sound flags
Merge SoundFlag and SoundStatus into a single enum; SoundEntry::setupStatus just casts one to another. Keep only definitions of bits in SoundFlag; drop compound flags like kFlagSteam = kSoundTypeAmbient | kSoundFlagLooped | kVolume7, use ORed simple flags in calls; change the signature of SoundManager::playSoundWithSubtitles to use uint32 instead of SoundFlag to avoid excess casting. Add meaningful names to flags; add some comments. Get rid of endian-unsafe SoundStatusUnion. Fixes an issue with big-endian hosts. No changes in behaviour on little-endian hosts.
Diffstat (limited to 'engines/lastexpress')
-rw-r--r--engines/lastexpress/entities/abbot.cpp2
-rw-r--r--engines/lastexpress/entities/anna.cpp14
-rw-r--r--engines/lastexpress/entities/august.cpp8
-rw-r--r--engines/lastexpress/entities/boutarel.cpp2
-rw-r--r--engines/lastexpress/entities/chapters.cpp22
-rw-r--r--engines/lastexpress/entities/coudert.cpp2
-rw-r--r--engines/lastexpress/entities/entity.h2
-rw-r--r--engines/lastexpress/entities/gendarmes.cpp16
-rw-r--r--engines/lastexpress/entities/gendarmes.h2
-rw-r--r--engines/lastexpress/entities/kahina.cpp2
-rw-r--r--engines/lastexpress/entities/mahmud.cpp4
-rw-r--r--engines/lastexpress/entities/mertens.cpp8
-rw-r--r--engines/lastexpress/entities/milos.cpp2
-rw-r--r--engines/lastexpress/entities/pascale.cpp8
-rw-r--r--engines/lastexpress/entities/rebecca.cpp4
-rw-r--r--engines/lastexpress/entities/tables.cpp8
-rw-r--r--engines/lastexpress/entities/tatiana.cpp2
-rw-r--r--engines/lastexpress/entities/train.cpp30
-rw-r--r--engines/lastexpress/entities/vassili.cpp4
-rw-r--r--engines/lastexpress/entities/verges.cpp4
-rw-r--r--engines/lastexpress/entities/vesna.cpp4
-rw-r--r--engines/lastexpress/fight/fighter_anna.cpp2
-rw-r--r--engines/lastexpress/fight/fighter_ivo.cpp2
-rw-r--r--engines/lastexpress/fight/fighter_milos.cpp4
-rw-r--r--engines/lastexpress/fight/fighter_salko.cpp2
-rw-r--r--engines/lastexpress/fight/fighter_vesna.cpp2
-rw-r--r--engines/lastexpress/game/action.cpp18
-rw-r--r--engines/lastexpress/game/entities.cpp4
-rw-r--r--engines/lastexpress/game/inventory.cpp4
-rw-r--r--engines/lastexpress/game/scenes.cpp4
-rw-r--r--engines/lastexpress/menu/menu.cpp6
-rw-r--r--engines/lastexpress/shared.h152
-rw-r--r--engines/lastexpress/sound/entry.cpp105
-rw-r--r--engines/lastexpress/sound/entry.h28
-rw-r--r--engines/lastexpress/sound/queue.cpp14
-rw-r--r--engines/lastexpress/sound/sound.cpp114
-rw-r--r--engines/lastexpress/sound/sound.h6
37 files changed, 331 insertions, 286 deletions
diff --git a/engines/lastexpress/entities/abbot.cpp b/engines/lastexpress/entities/abbot.cpp
index 99b9ee3bc2..48fb36a20f 100644
--- a/engines/lastexpress/entities/abbot.cpp
+++ b/engines/lastexpress/entities/abbot.cpp
@@ -1119,7 +1119,7 @@ IMPLEMENT_FUNCTION(35, Abbot, inSalon3)
case 2:
getData()->location = kLocationOutsideCompartment;
- getSound()->playSound(kEntityAbbot, "Abb3040", kFlagInvalid, 45);
+ getSound()->playSound(kEntityAbbot, "Abb3040", kSoundVolumeEntityDefault, 45);
getEntities()->updatePositionEnter(kEntityAbbot, kCarRestaurant, 57);
setCallback(3);
diff --git a/engines/lastexpress/entities/anna.cpp b/engines/lastexpress/entities/anna.cpp
index 80ad1a2ae4..37c6d1065c 100644
--- a/engines/lastexpress/entities/anna.cpp
+++ b/engines/lastexpress/entities/anna.cpp
@@ -2075,7 +2075,7 @@ IMPLEMENT_FUNCTION(47, Anna, goLunch)
break;
case 4:
- getSound()->playSound(kEntityAnna, getEvent(kEventAugustLunch) ? "Ann3136" : "Ann3136A", kFlagInvalid, 30);
+ getSound()->playSound(kEntityAnna, getEvent(kEventAugustLunch) ? "Ann3136" : "Ann3136A", kSoundVolumeEntityDefault, 30);
getSavePoints()->push(kEntityAnna, kEntityAugust, kAction122358304);
setCallback(5);
@@ -2270,7 +2270,7 @@ IMPLEMENT_FUNCTION(51, Anna, afterLunch)
break;
case kActionDefault:
- getSound()->playSound(kEntityAnna, "Ann3142", kFlagInvalid, 30);
+ getSound()->playSound(kEntityAnna, "Ann3142", kSoundVolumeEntityDefault, 30);
getEntities()->updatePositionEnter(kEntityAnna, kCarRestaurant, 57);
getEntities()->drawSequenceRight(kEntityAnna, "112A");
if (getEntities()->isInRestaurant(kEntityPlayer))
@@ -3865,7 +3865,7 @@ IMPLEMENT_FUNCTION(78, Anna, kidnapped)
case 2:
getAction()->playAnimation(kEventKronosHostageAnna);
getScenes()->loadSceneFromPosition(kCarRestaurant, 61, 1);
- getSound()->playSound(kEntityAnna, "Mus024", kFlagDefault);
+ getSound()->playSound(kEntityAnna, "Mus024", kVolumeFull);
setup_waiting();
break;
}
@@ -3936,11 +3936,11 @@ IMPLEMENT_FUNCTION(80, Anna, finalSequence)
if (!Entity::updateParameter(params->param1, getState()->timeTicks, 450))
break;
- getSound()->playSound(kEntityPlayer, "Kro5001", kFlagDefault);
+ getSound()->playSound(kEntityPlayer, "Kro5001", kVolumeFull);
break;
case kActionEndSound:
- getSound()->playSound(kEntityPlayer, "Kro5002", kFlagDefault);
+ getSound()->playSound(kEntityPlayer, "Kro5002", kVolumeFull);
getState()->time = kTime4929300;
setCallback(2);
@@ -3965,7 +3965,7 @@ IMPLEMENT_FUNCTION(80, Anna, finalSequence)
getAction()->playAnimation(kEventKronosBringFirebird);
getScenes()->loadSceneFromItem(kItemFirebird);
- getSound()->playSound(kEntityAnna, "Mus025", kFlagDefault);
+ getSound()->playSound(kEntityAnna, "Mus025", kVolumeFull);
break;
case 2:
@@ -4006,7 +4006,7 @@ IMPLEMENT_FUNCTION(81, Anna, openFirebird)
if (!Entity::updateParameter(params->param1, getState()->timeTicks, 180))
break;
- getSound()->playSound(kEntityTrain, "LIB069", kFlagDefault);
+ getSound()->playSound(kEntityTrain, "LIB069", kVolumeFull);
getLogic()->gameOver(kSavegameTypeIndex, 0, kSceneNone, true);
break;
diff --git a/engines/lastexpress/entities/august.cpp b/engines/lastexpress/entities/august.cpp
index 20f54ed50d..434d09c196 100644
--- a/engines/lastexpress/entities/august.cpp
+++ b/engines/lastexpress/entities/august.cpp
@@ -199,7 +199,7 @@ IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
IMPLEMENT_FUNCTION_S(13, August, playSound16)
- Entity::playSound(savepoint, false, kFlagDefault);
+ Entity::playSound(savepoint, false, kVolumeFull);
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
@@ -338,7 +338,7 @@ IMPLEMENT_FUNCTION_II(19, August, function19, bool, bool)
case kAction1:
getData()->inventoryItem = kItemNone;
getSound()->playSound(kEntityPlayer, "CAT1002");
- getSound()->playSound(kEntityAugust, "AUG3101", kFlagInvalid, 15);
+ getSound()->playSound(kEntityAugust, "AUG3101", kSoundVolumeEntityDefault, 15);
break;
case kActionDefault:
@@ -2208,7 +2208,7 @@ IMPLEMENT_FUNCTION_III(42, August, function42, CarIndex, EntityPosition, bool)
getData()->inventoryItem = kItemNone;
getSound()->playSound(kEntityPlayer, "CAT1002");
- getSound()->playSound(kEntityAugust, getEvent(kEventAugustBringBriefcase) ? "AUG3103" : "AUG3100", kFlagInvalid, 15);
+ getSound()->playSound(kEntityAugust, getEvent(kEventAugustBringBriefcase) ? "AUG3103" : "AUG3100", kSoundVolumeEntityDefault, 15);
break;
case kActionExcuseMe:
@@ -2415,7 +2415,7 @@ IMPLEMENT_FUNCTION(45, August, function45)
case kAction1:
getData()->inventoryItem = kItemNone;
getSound()->playSound(kEntityPlayer, "CAT1002");
- getSound()->playSound(kEntityAugust, "AUG3102", kFlagInvalid, 15);
+ getSound()->playSound(kEntityAugust, "AUG3102", kSoundVolumeEntityDefault, 15);
break;
case kActionDefault:
diff --git a/engines/lastexpress/entities/boutarel.cpp b/engines/lastexpress/entities/boutarel.cpp
index 3a0fbbdb24..f95dfe944b 100644
--- a/engines/lastexpress/entities/boutarel.cpp
+++ b/engines/lastexpress/entities/boutarel.cpp
@@ -214,7 +214,7 @@ IMPLEMENT_FUNCTION_I(11, Boutarel, function11, bool)
break;
case kChapter1:
- getSound()->playSound(kEntityBoutarel, "MRB1075", kFlagInvalid, 60);
+ getSound()->playSound(kEntityBoutarel, "MRB1075", kSoundVolumeEntityDefault, 60);
break;
case kChapter3:
diff --git a/engines/lastexpress/entities/chapters.cpp b/engines/lastexpress/entities/chapters.cpp
index 2b7aa92e9f..95d1092fd8 100644
--- a/engines/lastexpress/entities/chapters.cpp
+++ b/engines/lastexpress/entities/chapters.cpp
@@ -162,7 +162,7 @@ IMPLEMENT_FUNCTION(6, Chapters, firstDream)
break;
case kActionEndSound:
- getSound()->playSound(kEntityChapters, "MUS009", kFlagDefault);
+ getSound()->playSound(kEntityChapters, "MUS009", kVolumeFull);
break;
case kActionKnock:
@@ -194,10 +194,10 @@ IMPLEMENT_FUNCTION(6, Chapters, firstDream)
callbackAction();
} else {
getSound()->playSound(kEntityPlayer, "LIB014");
- getSound()->playSound(kEntityPlayer, "LIB015", kFlagDefault, 15);
+ getSound()->playSound(kEntityPlayer, "LIB015", kVolumeFull, 15);
if (!getSoundQueue()->isBuffered(kEntityChapters))
- getSound()->playSound(kEntityChapters, "MUS009", kFlagDefault);
+ getSound()->playSound(kEntityChapters, "MUS009", kVolumeFull);
getScenes()->loadSceneFromPosition(kCarLocomotive, 38);
@@ -268,7 +268,7 @@ IMPLEMENT_FUNCTION(6, Chapters, firstDream)
else if (getSoundQueue()->isBuffered("ZFX1007B"))
getSoundQueue()->processEntry("ZFX1007B");
- getSound()->playSound(kEntityPlayer, "MUS008", kFlagDefault);
+ getSound()->playSound(kEntityPlayer, "MUS008", kVolumeFull);
getInventory()->unselectItem();
// TODO: fade to black screen
@@ -720,7 +720,7 @@ IMPLEMENT_FUNCTION(9, Chapters, chapter1Next)
ENTITY_PARAM(0, 3) = 0;
}
- getSound()->playSound(kEntityPlayer, "MUS008", kFlagDefault);
+ getSound()->playSound(kEntityPlayer, "MUS008", kVolumeFull);
getInventory()->unselectItem();
// TODO: fade to black screen
@@ -1483,7 +1483,7 @@ label_callback_4:
case 11:
getScenes()->loadSceneFromPosition(kCarRedSleeping, 74);
- getSound()->playSound(kEntityTrain, "ZFX4001", kFlagDefault);
+ getSound()->playSound(kEntityTrain, "ZFX4001", kVolumeFull);
getLogic()->gameOver(kSavegameTypeIndex, 1, kSceneNone, true);
break;
}
@@ -1539,7 +1539,7 @@ label_callback_4:
// BUG: the original game fades to black screen twice, before MUS008 starts playing
// (the second call just makes a delay)
- getSound()->playSound(kEntityPlayer, "MUS008", kFlagDefault);
+ getSound()->playSound(kEntityPlayer, "MUS008", kVolumeFull);
getInventory()->unselectItem();
// TODO: fade to black screen
@@ -1608,7 +1608,7 @@ label_callback_4:
if (getSoundQueue()->isBuffered(kEntityChapters))
getSoundQueue()->removeFromQueue(kEntityChapters);
- getSound()->playSound(kEntityTrain, "ZFX4001", kFlagDefault);
+ getSound()->playSound(kEntityTrain, "ZFX4001", kVolumeFull);
getLogic()->gameOver(kSavegameTypeIndex, 0, kSceneNone, true);
break;
@@ -1746,7 +1746,7 @@ IMPLEMENT_FUNCTION(22, Chapters, chapter5Handler)
params->param2 = 1;
if (!getProgress().isNightTime) {
- getSound()->playSound(kEntityChapters, "ARRIVE", kFlag8);
+ getSound()->playSound(kEntityChapters, "ARRIVE", kVolume8);
getSoundQueue()->processEntries();
}
}
@@ -1755,7 +1755,7 @@ IMPLEMENT_FUNCTION(22, Chapters, chapter5Handler)
params->param3 = 1;
if (!getEvent(kEventLocomotiveMilosDay) && !getEvent(kEventLocomotiveMilosNight)) {
- getSound()->playSound(kEntityChapters, "ARRIVE", kFlag8);
+ getSound()->playSound(kEntityChapters, "ARRIVE", kVolume8);
getSoundQueue()->processEntries();
}
}
@@ -1868,7 +1868,7 @@ void Chapters::enterExitStation(const SavePoint &savepoint, bool isEnteringStati
void Chapters::enterExitHelper(bool isEnteringStation) {
EXPOSE_PARAMS(EntityData::EntityParametersSIIS);
- getSound()->playSound(kEntityChapters, isEnteringStation ? "ARRIVE" : "DEPART", kFlag8);
+ getSound()->playSound(kEntityChapters, isEnteringStation ? "ARRIVE" : "DEPART", kVolume8);
getSoundQueue()->processEntries();
getObjects()->update(kObjectHandleOutsideLeft, kEntityPlayer, kObjectLocation1, kCursorNormal, isEnteringStation ? kCursorNormal : kCursorHand);
diff --git a/engines/lastexpress/entities/coudert.cpp b/engines/lastexpress/entities/coudert.cpp
index 4a714e2852..af06d610e7 100644
--- a/engines/lastexpress/entities/coudert.cpp
+++ b/engines/lastexpress/entities/coudert.cpp
@@ -249,7 +249,7 @@ IMPLEMENT_FUNCTION_NOSETUP(7, Coudert, playSound16)
break;
case kActionDefault:
- getSound()->playSound(kEntityCoudert, (char *)&params->seq1, kFlagDefault);
+ getSound()->playSound(kEntityCoudert, (char *)&params->seq1, kVolumeFull);
break;
case kActionCallback:
diff --git a/engines/lastexpress/entities/entity.h b/engines/lastexpress/entities/entity.h
index 22bfe6773e..627ab834ab 100644
--- a/engines/lastexpress/entities/entity.h
+++ b/engines/lastexpress/entities/entity.h
@@ -972,7 +972,7 @@ protected:
* @param resetItem true to reset item.
* @param flag sound flag
*/
- void playSound(const SavePoint &savepoint, bool resetItem = false, SoundFlag flag = kFlagInvalid);
+ void playSound(const SavePoint &savepoint, bool resetItem = false, SoundFlag flag = kSoundVolumeEntityDefault);
/**
* Draws the entity
diff --git a/engines/lastexpress/entities/gendarmes.cpp b/engines/lastexpress/entities/gendarmes.cpp
index 981ad461d6..108f3c1186 100644
--- a/engines/lastexpress/entities/gendarmes.cpp
+++ b/engines/lastexpress/entities/gendarmes.cpp
@@ -87,12 +87,12 @@ IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
IMPLEMENT_FUNCTION_S(5, Gendarmes, doDialogFullVolume)
- handleAction(savepoint, true, kFlagDefault);
+ handleAction(savepoint, true, kVolumeFull);
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
IMPLEMENT_FUNCTION_I(6, Gendarmes, doWait, uint32)
- handleAction(savepoint, true, kFlagInvalid, true);
+ handleAction(savepoint, true, kSoundVolumeEntityDefault, true);
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
@@ -102,7 +102,7 @@ IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
IMPLEMENT_FUNCTION_II(8, Gendarmes, doWalk, CarIndex, EntityPosition)
- handleAction(savepoint, true, kFlagInvalid, false, true);
+ handleAction(savepoint, true, kSoundVolumeEntityDefault, false, true);
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
@@ -223,7 +223,7 @@ IMPLEMENT_FUNCTION_IISS(9, Gendarmes, doCompartment, CarIndex, EntityPosition)
strcpy(arrestSound, "POL1043");
strcat(arrestSound, (char *)&params->seq2);
- getSound()->playSound(kEntityGendarmes, arrestSound, kFlagInvalid, 30);
+ getSound()->playSound(kEntityGendarmes, arrestSound, kSoundVolumeEntityDefault, 30);
}
getData()->location = kLocationInsideCompartment;
@@ -266,7 +266,7 @@ IMPLEMENT_FUNCTION_III(10, Gendarmes, trappedCath, CarIndex, EntityPosition, Obj
if (params->param6 == 0 || getState()->timeTicks > (uint32)params->param6) {
params->param6 = kTimeInvalid;
- getSound()->playSound(kEntityGendarmes, "POL1046A", kFlagDefault);
+ getSound()->playSound(kEntityGendarmes, "POL1046A", kVolumeFull);
}
if (!Entity::updateParameter(params->param7, getState()->timeTicks, 300))
@@ -279,7 +279,7 @@ IMPLEMENT_FUNCTION_III(10, Gendarmes, trappedCath, CarIndex, EntityPosition, Obj
if (getEntities()->isOutsideAlexeiWindow())
getScenes()->loadSceneFromPosition(kCarGreenSleeping, 49);
- getSound()->playSound(kEntityGendarmes, "LIB017", kFlagDefault);
+ getSound()->playSound(kEntityGendarmes, "LIB017", kVolumeFull);
setCallback(getProgress().jacket == kJacketBlood ? 3 : 4);
setup_savegame(kSavegameTypeEvent, getProgress().jacket == kJacketBlood ? kEventMertensBloodJacket : kEventGendarmesArrestation);
@@ -315,7 +315,7 @@ IMPLEMENT_FUNCTION_III(10, Gendarmes, trappedCath, CarIndex, EntityPosition, Obj
break;
case 2:
- getSound()->playSound(kEntityGendarmes, "LIB014", kFlagDefault);
+ getSound()->playSound(kEntityGendarmes, "LIB014", kVolumeFull);
getAction()->playAnimation(kEventGendarmesArrestation);
getLogic()->gameOver(kSavegameTypeIndex, 1, kSceneGameOverPolice1, true);
break;
@@ -342,7 +342,7 @@ IMPLEMENT_FUNCTION_III(10, Gendarmes, trappedCath, CarIndex, EntityPosition, Obj
break;
case 6:
- getSound()->playSound(kEntityGendarmes, "LIB014", kFlagDefault);
+ getSound()->playSound(kEntityGendarmes, "LIB014", kVolumeFull);
getAction()->playAnimation(kEventGendarmesArrestation);
getLogic()->gameOver(kSavegameTypeIndex, 1, kSceneGameOverPolice1, true);
break;
diff --git a/engines/lastexpress/entities/gendarmes.h b/engines/lastexpress/entities/gendarmes.h
index 1cde626a22..c849597edf 100644
--- a/engines/lastexpress/entities/gendarmes.h
+++ b/engines/lastexpress/entities/gendarmes.h
@@ -87,7 +87,7 @@ public:
DECLARE_FUNCTION(chapter5)
private:
- void handleAction(const SavePoint &savepoint, bool playSound = false, SoundFlag flag = kFlagInvalid, bool checkCallback = false, bool shouldUpdateEntity = false);
+ void handleAction(const SavePoint &savepoint, bool playSound = false, SoundFlag flag = kSoundVolumeEntityDefault, bool checkCallback = false, bool shouldUpdateEntity = false);
};
} // End of namespace LastExpress
diff --git a/engines/lastexpress/entities/kahina.cpp b/engines/lastexpress/entities/kahina.cpp
index 4ff534eec0..accbe7dcdc 100644
--- a/engines/lastexpress/entities/kahina.cpp
+++ b/engines/lastexpress/entities/kahina.cpp
@@ -1188,7 +1188,7 @@ IMPLEMENT_FUNCTION(24, Kahina, seekCath)
getEntities()->updateEntity(kEntityKahina, kCarKronos, kPosition_9270);
getEntities()->loadSceneFromEntityPosition(getData()->car, (EntityPosition)(getData()->entityPosition + 750));
getSavePoints()->push(kEntityKahina, kEntityKronos, kAction235599361);
- getSound()->playSound(kEntityKahina, "MUS016", kFlagDefault);
+ getSound()->playSound(kEntityKahina, "MUS016", kVolumeFull);
getProgress().field_44 = 1;
params->param1 = true;
diff --git a/engines/lastexpress/entities/mahmud.cpp b/engines/lastexpress/entities/mahmud.cpp
index 1468bce5a7..47a9e85716 100644
--- a/engines/lastexpress/entities/mahmud.cpp
+++ b/engines/lastexpress/entities/mahmud.cpp
@@ -206,7 +206,7 @@ IMPLEMENT_FUNCTION_II(10, Mahmud, function10, ObjectIndex, bool)
if (getState()->time >= kTimeCityGalanta) {
params->param3 = 0;
} else {
- getSound()->playSound(kEntityTrain, "LIB050", kFlagDefault);
+ getSound()->playSound(kEntityTrain, "LIB050", kVolumeFull);
getLogic()->gameOver(kSavegameTypeIndex, 0, (getProgress().chapter == kChapter1) ? kSceneGameOverPolice1 : kSceneGameOverPolice2, true);
}
break;
@@ -237,7 +237,7 @@ IMPLEMENT_FUNCTION_II(10, Mahmud, function10, ObjectIndex, bool)
break;
case kActionDefault:
- getSound()->playSound(kEntityMahmud, params->param2 ? "MAH1170A" : "MAH1173", kFlagInvalid, 45);
+ getSound()->playSound(kEntityMahmud, params->param2 ? "MAH1170A" : "MAH1173", kSoundVolumeEntityDefault, 45);
getProgress().field_C4 = 1;
setCallback(1);
diff --git a/engines/lastexpress/entities/mertens.cpp b/engines/lastexpress/entities/mertens.cpp
index 1140bfabe2..db900091c7 100644
--- a/engines/lastexpress/entities/mertens.cpp
+++ b/engines/lastexpress/entities/mertens.cpp
@@ -281,7 +281,7 @@ IMPLEMENT_FUNCTION_S(8, Mertens, playSound16)
break;
case kActionDefault:
- getSound()->playSound(kEntityMertens, (char *)&params->seq1, kFlagDefault);
+ getSound()->playSound(kEntityMertens, (char *)&params->seq1, kVolumeFull);
break;
case kActionCallback:
@@ -918,7 +918,7 @@ IMPLEMENT_FUNCTION(17, Mertens, function17)
} else {
// Got the passenger list, Mertens is looking for it before sitting
ENTITY_PARAM(0, 2) = 1;
- getSound()->playSound(kEntityMertens, "CON1058", kFlagInvalid, 75);
+ getSound()->playSound(kEntityMertens, "CON1058", kSoundVolumeEntityDefault, 75);
getEntities()->drawSequenceRight(kEntityMertens, "601D");
}
@@ -1006,7 +1006,7 @@ IMPLEMENT_FUNCTION(18, Mertens, function18)
getEntities()->drawSequenceRight(kEntityMertens, "601A");
} else {
ENTITY_PARAM(0, 2) = 1;
- getSound()->playSound(kEntityMertens, "CON1058", kFlagInvalid, 75);
+ getSound()->playSound(kEntityMertens, "CON1058", kSoundVolumeEntityDefault, 75);
getEntities()->drawSequenceRight(kEntityMertens, "601D");
}
@@ -1222,7 +1222,7 @@ IMPLEMENT_FUNCTION(22, Mertens, function22)
getData()->location = kLocationInsideCompartment;
getEntities()->clearSequences(kEntityMertens);
if (!getSoundQueue()->isBuffered(kEntityMertens))
- getSound()->playSound(kEntityMertens, "MAH1172", kFlagInvalid, 225);
+ getSound()->playSound(kEntityMertens, "MAH1172", kSoundVolumeEntityDefault, 225);
setCallback(7);
setup_function21(kObjectCompartment4, kObject20);
diff --git a/engines/lastexpress/entities/milos.cpp b/engines/lastexpress/entities/milos.cpp
index d982b5585a..fb139f96ac 100644
--- a/engines/lastexpress/entities/milos.cpp
+++ b/engines/lastexpress/entities/milos.cpp
@@ -111,7 +111,7 @@ IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
IMPLEMENT_FUNCTION_S(7, Milos, playSound16)
- Entity::playSound(savepoint, false, kFlagDefault);
+ Entity::playSound(savepoint, false, kVolumeFull);
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/lastexpress/entities/pascale.cpp b/engines/lastexpress/entities/pascale.cpp
index f5fa1aab30..0f19b8f44b 100644
--- a/engines/lastexpress/entities/pascale.cpp
+++ b/engines/lastexpress/entities/pascale.cpp
@@ -142,15 +142,15 @@ IMPLEMENT_FUNCTION(8, Pascale, welcomeSophieAndRebecca)
break;
case kChapter1:
- getSound()->playSound(kEntityPascale, "REB1198", kFlagInvalid, 30);
+ getSound()->playSound(kEntityPascale, "REB1198", kSoundVolumeEntityDefault, 30);
break;
case kChapter3:
- getSound()->playSound(kEntityPascale, "REB3001", kFlagInvalid, 30);
+ getSound()->playSound(kEntityPascale, "REB3001", kSoundVolumeEntityDefault, 30);
break;
case kChapter4:
- getSound()->playSound(kEntityPascale, "REB4001", kFlagInvalid, 30);
+ getSound()->playSound(kEntityPascale, "REB4001", kSoundVolumeEntityDefault, 30);
break;
}
@@ -755,7 +755,7 @@ IMPLEMENT_FUNCTION(24, Pascale, welcomeAbbot)
break;
case kActionDefault:
- getSound()->playSound(kEntityPascale, "ABB3015", kFlagInvalid, 105);
+ getSound()->playSound(kEntityPascale, "ABB3015", kSoundVolumeEntityDefault, 105);
getEntities()->drawSequenceRight(kEntityPascale, "029A1");
getEntities()->drawSequenceRight(kEntityAbbot, "029A2");
break;
diff --git a/engines/lastexpress/entities/rebecca.cpp b/engines/lastexpress/entities/rebecca.cpp
index fec0891ce9..8ef84fdab0 100644
--- a/engines/lastexpress/entities/rebecca.cpp
+++ b/engines/lastexpress/entities/rebecca.cpp
@@ -322,7 +322,7 @@ IMPLEMENT_FUNCTION_I(17, Rebecca, function17, bool)
getData()->location = kLocationOutsideCompartment;
if (getProgress().chapter == kChapter3)
- getSound()->playSound(kEntityRebecca, "Reb3005", kFlagInvalid, 75);
+ getSound()->playSound(kEntityRebecca, "Reb3005", kSoundVolumeEntityDefault, 75);
if (params->param1) {
setCallback(5);
@@ -1407,7 +1407,7 @@ label_callback_3:
params->param5 = kTimeInvalid;
getData()->inventoryItem = kItemNone;
- getSound()->playSound(kEntityRebecca, "Reb3008", kFlagInvalid, 60);
+ getSound()->playSound(kEntityRebecca, "Reb3008", kSoundVolumeEntityDefault, 60);
getEntities()->updatePositionEnter(kEntityRebecca, kCarRestaurant, 52);
setCallback(3);
diff --git a/engines/lastexpress/entities/tables.cpp b/engines/lastexpress/entities/tables.cpp
index 8701c012e4..b84c8c66fd 100644
--- a/engines/lastexpress/entities/tables.cpp
+++ b/engines/lastexpress/entities/tables.cpp
@@ -49,7 +49,7 @@ Tables::Tables(LastExpressEngine *engine, EntityIndex id) : Entity(engine, id) {
IMPLEMENT_FUNCTION(1, Tables, chapter1)
if (savepoint.action == kActionDefault) {
if (_id == kEntityTables2)
- getSound()->playSoundWithSubtitles("LOOP8A.SND", kFlagLoop, kEntityTables2);
+ getSound()->playSoundWithSubtitles("LOOP8A.SND", kSoundTypeWalla | kSoundFlagLooped | kVolume8, kEntityTables2);
setup_draw();
}
@@ -59,7 +59,7 @@ IMPLEMENT_FUNCTION_END
IMPLEMENT_FUNCTION(2, Tables, chapter2)
if (savepoint.action == kActionDefault) {
if (_id == kEntityTables2)
- getSound()->playSoundWithSubtitles("LOOP8A.SND", kFlagLoop, kEntityTables2);
+ getSound()->playSoundWithSubtitles("LOOP8A.SND", kSoundTypeWalla | kSoundFlagLooped | kVolume8, kEntityTables2);
setup_draw();
}
@@ -69,7 +69,7 @@ IMPLEMENT_FUNCTION_END
IMPLEMENT_FUNCTION(3, Tables, chapter3)
if (savepoint.action == kActionDefault) {
if (_id == kEntityTables2)
- getSound()->playSoundWithSubtitles("LOOP8A.SND", kFlagLoop, kEntityTables2);
+ getSound()->playSoundWithSubtitles("LOOP8A.SND", kSoundTypeWalla | kSoundFlagLooped | kVolume8, kEntityTables2);
setup_draw();
}
@@ -79,7 +79,7 @@ IMPLEMENT_FUNCTION_END
IMPLEMENT_FUNCTION(4, Tables, chapter4)
if (savepoint.action == kActionDefault) {
if (_id == kEntityTables2)
- getSound()->playSoundWithSubtitles("LOOP8A.SND", kFlagLoop, kEntityTables2);
+ getSound()->playSoundWithSubtitles("LOOP8A.SND", kSoundTypeWalla | kSoundFlagLooped | kVolume8, kEntityTables2);
setup_draw();
}
diff --git a/engines/lastexpress/entities/tatiana.cpp b/engines/lastexpress/entities/tatiana.cpp
index 31de491983..175600fef8 100644
--- a/engines/lastexpress/entities/tatiana.cpp
+++ b/engines/lastexpress/entities/tatiana.cpp
@@ -1960,7 +1960,7 @@ IMPLEMENT_FUNCTION(48, Tatiana, seekCath)
if (!Entity::updateParameter(params->param2, getState()->timeTicks, 5 * (3 * rnd(5) + 30)))
goto label_end;
- getSound()->playSound(kEntityTatiana, "LIB012", kFlagDefault);
+ getSound()->playSound(kEntityTatiana, "LIB012", kVolumeFull);
params->param2 = 0;
label_end:
diff --git a/engines/lastexpress/entities/train.cpp b/engines/lastexpress/entities/train.cpp
index c8cfe8cca8..e4ff976cae 100644
--- a/engines/lastexpress/entities/train.cpp
+++ b/engines/lastexpress/entities/train.cpp
@@ -118,7 +118,7 @@ IMPLEMENT_FUNCTION_II(7, Train, harem, ObjectIndex, uint32)
getObjects()->update((ObjectIndex)params->param1, kEntityTrain, kObjectLocation3, kCursorNormal, kCursorNormal);
// Knock / closed door sound
- getSound()->playSound(kEntityTables5, (params->param2 == 8) ? "LIB012" : "LIB013", kFlagDefault);
+ getSound()->playSound(kEntityTables5, (params->param2 == 8) ? "LIB012" : "LIB013", kVolumeFull);
if (params->param4 && params->param5) {
@@ -130,17 +130,17 @@ IMPLEMENT_FUNCTION_II(7, Train, harem, ObjectIndex, uint32)
break;
case 1:
- getSound()->playSound(kEntityTables5, "Har1014", kFlagDefault, 15);
+ getSound()->playSound(kEntityTables5, "Har1014", kVolumeFull, 15);
break;
case 2:
- getSound()->playSound(kEntityTables5, "Har1013", kFlagDefault, 15);
- getSound()->playSound(kEntityTables5, "Har1016", kFlagDefault, 150);
+ getSound()->playSound(kEntityTables5, "Har1013", kVolumeFull, 15);
+ getSound()->playSound(kEntityTables5, "Har1016", kVolumeFull, 150);
break;
case 3:
- getSound()->playSound(kEntityTables5, "Har1015A", kFlagDefault, 15);
- getSound()->playSound(kEntityTables5, "Har1015", kFlagDefault, 150);
+ getSound()->playSound(kEntityTables5, "Har1015A", kVolumeFull, 15);
+ getSound()->playSound(kEntityTables5, "Har1015", kVolumeFull, 150);
break;
}
@@ -164,15 +164,15 @@ IMPLEMENT_FUNCTION_II(7, Train, harem, ObjectIndex, uint32)
break;
case 1:
- getSound()->playSound(kEntityTables5, "Har1014", kFlagDefault, 15);
+ getSound()->playSound(kEntityTables5, "Har1014", kVolumeFull, 15);
break;
case 2:
- getSound()->playSound(kEntityTables5, "Har1013", kFlagDefault, 15);
+ getSound()->playSound(kEntityTables5, "Har1013", kVolumeFull, 15);
break;
case 3:
- getSound()->playSound(kEntityTables5, "Har1013A", kFlagDefault, 15);
+ getSound()->playSound(kEntityTables5, "Har1013A", kVolumeFull, 15);
break;
}
@@ -191,11 +191,11 @@ IMPLEMENT_FUNCTION_II(7, Train, harem, ObjectIndex, uint32)
break;
case 1:
- getSound()->playSound(kEntityTables5, "Har1012", kFlagDefault, 15);
+ getSound()->playSound(kEntityTables5, "Har1012", kVolumeFull, 15);
break;
case 2:
- getSound()->playSound(kEntityTables5, "Har1012A", kFlagDefault, 15);
+ getSound()->playSound(kEntityTables5, "Har1012A", kVolumeFull, 15);
break;
}
@@ -207,7 +207,7 @@ IMPLEMENT_FUNCTION_II(7, Train, harem, ObjectIndex, uint32)
ENTITY_PARAM(0, 1)++;
if (ENTITY_PARAM(0, 1) <= 1)
- getSound()->playSound(kEntityTables5, "Har1014", kFlagDefault, 15);
+ getSound()->playSound(kEntityTables5, "Har1014", kVolumeFull, 15);
else
params->param8 = 1;
@@ -221,7 +221,7 @@ IMPLEMENT_FUNCTION_II(7, Train, harem, ObjectIndex, uint32)
ENTITY_PARAM(0, 4)++;
if (ENTITY_PARAM(0, 4) <= 1) {
- getSound()->playSound(kEntityTables5, "Har1011", kFlagDefault, 15);
+ getSound()->playSound(kEntityTables5, "Har1011", kVolumeFull, 15);
handleCompartmentAction();
return;
}
@@ -241,11 +241,11 @@ IMPLEMENT_FUNCTION_II(7, Train, harem, ObjectIndex, uint32)
break;
case 1:
- getSound()->playSound(kEntityTables5, "Har1013", kFlagDefault, 15);
+ getSound()->playSound(kEntityTables5, "Har1013", kVolumeFull, 15);
break;
case 2:
- getSound()->playSound(kEntityTables5, "Har1013A", kFlagDefault, 15);
+ getSound()->playSound(kEntityTables5, "Har1013A", kVolumeFull, 15);
break;
}
diff --git a/engines/lastexpress/entities/vassili.cpp b/engines/lastexpress/entities/vassili.cpp
index 11a84f517b..5696a71160 100644
--- a/engines/lastexpress/entities/vassili.cpp
+++ b/engines/lastexpress/entities/vassili.cpp
@@ -265,7 +265,7 @@ IMPLEMENT_FUNCTION(8, Vassili, function8)
getSavePoints()->push(kEntityVassili, kEntityAnna, kAction226031488);
getSavePoints()->push(kEntityVassili, kEntityVerges, kAction226031488);
getSavePoints()->push(kEntityVassili, kEntityCoudert, kAction226031488);
- getSound()->playSound(kEntityVassili, "VAS1027", kFlagDefault);
+ getSound()->playSound(kEntityVassili, "VAS1027", kVolumeFull);
break;
}
IMPLEMENT_FUNCTION_END
@@ -297,7 +297,7 @@ IMPLEMENT_FUNCTION(9, Vassili, function9)
setup_seizure();
} else {
if (savepoint.action == kActionDefault)
- getSound()->playSound(kEntityVassili, "VAS1028", kFlagDefault);
+ getSound()->playSound(kEntityVassili, "VAS1028", kVolumeFull);
}
break;
}
diff --git a/engines/lastexpress/entities/verges.cpp b/engines/lastexpress/entities/verges.cpp
index 7811aa880f..9f7d0828e4 100644
--- a/engines/lastexpress/entities/verges.cpp
+++ b/engines/lastexpress/entities/verges.cpp
@@ -123,7 +123,7 @@ IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
IMPLEMENT_FUNCTION_NOSETUP(5, Verges, playSound16)
- Entity::playSound(savepoint, false, kFlagDefault);
+ Entity::playSound(savepoint, false, kVolumeFull);
IMPLEMENT_FUNCTION_END
//////////////////////////////////////////////////////////////////////////
@@ -700,7 +700,7 @@ IMPLEMENT_FUNCTION(24, Verges, policeGettingOffTrain)
break;
case kActionDefault:
- getSound()->playSound(kEntityVerges, "POL1101", kFlagDefault);
+ getSound()->playSound(kEntityVerges, "POL1101", kVolumeFull);
break;
case kActionCallback:
diff --git a/engines/lastexpress/entities/vesna.cpp b/engines/lastexpress/entities/vesna.cpp
index af7adfa327..31955b72da 100644
--- a/engines/lastexpress/entities/vesna.cpp
+++ b/engines/lastexpress/entities/vesna.cpp
@@ -1079,7 +1079,7 @@ IMPLEMENT_FUNCTION(30, Vesna, climbing)
case kActionNone:
if (!params->param1) {
if (Entity::updateParameter(params->param3, getState()->timeTicks, 120)) {
- getSound()->playSound(kEntityVesna, "Ves5001", kFlagDefault);
+ getSound()->playSound(kEntityVesna, "Ves5001", kVolumeFull);
params->param1 = 1;
}
}
@@ -1144,7 +1144,7 @@ IMPLEMENT_FUNCTION(30, Vesna, climbing)
setCallback(2);
setup_savegame(kSavegameTypeEvent, kEventCathVesnaTrainTopKilled);
} else {
- getSound()->playSound(kEntityVesna, "Ves5001", kFlagDefault);
+ getSound()->playSound(kEntityVesna, "Ves5001", kVolumeFull);
params->param1 = 1;
}
break;
diff --git a/engines/lastexpress/fight/fighter_anna.cpp b/engines/lastexpress/fight/fighter_anna.cpp
index 723bd38cf0..4fdb71a6e4 100644
--- a/engines/lastexpress/fight/fighter_anna.cpp
+++ b/engines/lastexpress/fight/fighter_anna.cpp
@@ -125,7 +125,7 @@ FighterOpponentAnna::FighterOpponentAnna(LastExpressEngine *engine) : Opponent(e
_sequences.push_back(loadSequence("2002okml.seq"));
_sequences.push_back(loadSequence("2002okm.seq"));
- getSound()->playSound(kEntityTables0, "MUS030", kFlagDefault);
+ getSound()->playSound(kEntityTables0, "MUS030", kVolumeFull);
_field_38 = 30;
}
diff --git a/engines/lastexpress/fight/fighter_ivo.cpp b/engines/lastexpress/fight/fighter_ivo.cpp
index 7bd9968da2..d5289ab0b7 100644
--- a/engines/lastexpress/fight/fighter_ivo.cpp
+++ b/engines/lastexpress/fight/fighter_ivo.cpp
@@ -145,7 +145,7 @@ FighterOpponentIvo::FighterOpponentIvo(LastExpressEngine *engine) : Opponent(eng
_sequences.push_back(loadSequence("csdr.seq"));
_sequences.push_back(loadSequence("2003l.seq"));
- getSound()->playSound(kEntityTables0, "MUS032", kFlagDefault);
+ getSound()->playSound(kEntityTables0, "MUS032", kVolumeFull);
_countdown = 5;
_field_38 = 15;
diff --git a/engines/lastexpress/fight/fighter_milos.cpp b/engines/lastexpress/fight/fighter_milos.cpp
index 5b98b87304..5493d26ca5 100644
--- a/engines/lastexpress/fight/fighter_milos.cpp
+++ b/engines/lastexpress/fight/fighter_milos.cpp
@@ -109,7 +109,7 @@ void FighterPlayerMilos::update() {
_opponent->setSequenceAndDraw(6, kFightSequenceType1);
getSoundQueue()->removeFromQueue(kEntityTables0);
- getSound()->playSound(kEntityTrain, "MUS029", kFlagDefault);
+ getSound()->playSound(kEntityTrain, "MUS029", kVolumeFull);
handleAction(kFightActionWin);
}
@@ -149,7 +149,7 @@ FighterOpponentMilos::FighterOpponentMilos(LastExpressEngine *engine) : Opponent
_sequences.push_back(loadSequence("2001dbk.seq"));
_sequences.push_back(loadSequence("2001wbk.seq"));
- getSound()->playSound(kEntityTables0, "MUS027", kFlagDefault);
+ getSound()->playSound(kEntityTables0, "MUS027", kVolumeFull);
_field_38 = 35;
}
diff --git a/engines/lastexpress/fight/fighter_salko.cpp b/engines/lastexpress/fight/fighter_salko.cpp
index c0d15ec183..a11bf292d5 100644
--- a/engines/lastexpress/fight/fighter_salko.cpp
+++ b/engines/lastexpress/fight/fighter_salko.cpp
@@ -133,7 +133,7 @@ FighterOpponentSalko::FighterOpponentSalko(LastExpressEngine *engine) : Opponent
_sequences.push_back(loadSequence("2004ohm.seq"));
_sequences.push_back(loadSequence("blank.seq"));
- getSound()->playSound(kEntityTables0, "MUS035", kFlagDefault);
+ getSound()->playSound(kEntityTables0, "MUS035", kVolumeFull);
_countdown = 3;
_field_38 = 30;
diff --git a/engines/lastexpress/fight/fighter_vesna.cpp b/engines/lastexpress/fight/fighter_vesna.cpp
index eeb00b821b..eba30faf25 100644
--- a/engines/lastexpress/fight/fighter_vesna.cpp
+++ b/engines/lastexpress/fight/fighter_vesna.cpp
@@ -151,7 +151,7 @@ FighterOpponentVesna::FighterOpponentVesna(LastExpressEngine *engine) : Opponent
_sequences.push_back(loadSequence("2005csbm.seq"));
_sequences.push_back(loadSequence("2005oam4.seq"));
- getSound()->playSound(kEntityTables0, "MUS038", kFlagDefault);
+ getSound()->playSound(kEntityTables0, "MUS038", kVolumeFull);
_countdown = 4;
_field_38 = 30;
diff --git a/engines/lastexpress/game/action.cpp b/engines/lastexpress/game/action.cpp
index 96b97db939..f623ed032e 100644
--- a/engines/lastexpress/game/action.cpp
+++ b/engines/lastexpress/game/action.cpp
@@ -479,7 +479,7 @@ IMPLEMENT_ACTION(playMusic)
Common::String filename = Common::String::format("MUS%03d", hotspot.param1);
if (!getSoundQueue()->isBuffered(filename) && (hotspot.param1 != 50 || getProgress().chapter == kChapter5))
- getSound()->playSound(kEntityPlayer, filename, kFlagDefault, hotspot.param2);
+ getSound()->playSound(kEntityPlayer, filename, kVolumeFull, hotspot.param2);
return kSceneInvalid;
}
@@ -819,7 +819,7 @@ IMPLEMENT_ACTION(enterCompartment)
getSound()->playSoundEvent(kEntityPlayer, 15, 22);
if (getProgress().field_78 && !getSoundQueue()->isBuffered("MUS003")) {
- getSound()->playSound(kEntityPlayer, "MUS003", kFlagDefault);
+ getSound()->playSound(kEntityPlayer, "MUS003", kVolumeFull);
getProgress().field_78 = 0;
}
@@ -1097,7 +1097,7 @@ IMPLEMENT_ACTION(enterBaggage)
case 2:
if (!getSoundQueue()->isBuffered("MUS021"))
- getSound()->playSound(kEntityPlayer, "MUS021", kFlagDefault);
+ getSound()->playSound(kEntityPlayer, "MUS021", kVolumeFull);
break;
case 3:
@@ -1196,7 +1196,7 @@ IMPLEMENT_ACTION(29)
Common::String filename = Common::String::format("MUS%03d", hotspot.param3);
if (!getSoundQueue()->isBuffered(filename))
- getSound()->playSound(kEntityPlayer, filename, kFlagDefault);
+ getSound()->playSound(kEntityPlayer, filename, kVolumeFull);
return kSceneInvalid;
}
@@ -1358,7 +1358,7 @@ IMPLEMENT_ACTION(openBed)
//////////////////////////////////////////////////////////////////////////
// Action 37
IMPLEMENT_ACTION(dialog)
- getSound()->playDialog(kEntityTables4, (EntityIndex)hotspot.param1, kFlagDefault, 0);
+ getSound()->playDialog(kEntityTables4, (EntityIndex)hotspot.param1, kVolumeFull, 0);
return kSceneInvalid;
}
@@ -1368,7 +1368,7 @@ IMPLEMENT_ACTION(dialog)
IMPLEMENT_ACTION(eggBox)
getSound()->playSoundEvent(kEntityPlayer, 43);
if (getProgress().field_7C && !getSoundQueue()->isBuffered("MUS003")) {
- getSound()->playSound(kEntityPlayer, "MUS003", kFlagDefault);
+ getSound()->playSound(kEntityPlayer, "MUS003", kVolumeFull);
getProgress().field_7C = 0;
}
@@ -1380,7 +1380,7 @@ IMPLEMENT_ACTION(eggBox)
IMPLEMENT_ACTION(39)
getSound()->playSoundEvent(kEntityPlayer, 24);
if (getProgress().field_80 && !getSoundQueue()->isBuffered("MUS003")) {
- getSound()->playSound(kEntityPlayer, "MUS003", kFlagDefault);
+ getSound()->playSound(kEntityPlayer, "MUS003", kVolumeFull);
getProgress().field_80 = 0;
}
@@ -1422,7 +1422,7 @@ IMPLEMENT_ACTION(playMusicChapter)
Common::String filename = Common::String::format("MUS%03d", id);
if (!getSoundQueue()->isBuffered(filename))
- getSound()->playSound(kEntityPlayer, filename, kFlagDefault);
+ getSound()->playSound(kEntityPlayer, filename, kVolumeFull);
}
return kSceneInvalid;
@@ -1454,7 +1454,7 @@ IMPLEMENT_ACTION(playMusicChapterSetupTrain)
Common::String filename = Common::String::format("MUS%03d", hotspot.param1);
if (!getSoundQueue()->isBuffered(filename) && hotspot.param3 & id) {
- getSound()->playSound(kEntityPlayer, filename, kFlagDefault);
+ getSound()->playSound(kEntityPlayer, filename, kVolumeFull);
getSavePoints()->call(kEntityPlayer, kEntityTrain, kAction203863200, filename);
getSavePoints()->push(kEntityPlayer, kEntityTrain, kAction222746496, hotspot.param2);
diff --git a/engines/lastexpress/game/entities.cpp b/engines/lastexpress/game/entities.cpp
index 1afebbbfaf..059d2deb87 100644
--- a/engines/lastexpress/game/entities.cpp
+++ b/engines/lastexpress/game/entities.cpp
@@ -2344,7 +2344,7 @@ bool Entities::changeCar(EntityData::EntityCallData *data, EntityIndex entity, C
if (data->car == newCar) {
if (isInGreenCarEntrance(kEntityPlayer)) {
getSound()->playSoundEvent(kEntityPlayer, 14);
- getSound()->excuseMe(entity, kEntityPlayer, kFlagDefault);
+ getSound()->excuseMe(entity, kEntityPlayer, kVolumeFull);
getScenes()->loadSceneFromPosition(kCarGreenSleeping, 1);
getSound()->playSound(kEntityPlayer, "CAT1127A");
getSound()->playSoundEvent(kEntityPlayer, 15);
@@ -2363,7 +2363,7 @@ bool Entities::changeCar(EntityData::EntityCallData *data, EntityIndex entity, C
if (data->car == newCar) {
if (isInKronosCarEntrance(kEntityPlayer)) {
getSound()->playSoundEvent(kEntityPlayer, 14);
- getSound()->excuseMe(entity, kEntityPlayer, kFlagDefault);
+ getSound()->excuseMe(entity, kEntityPlayer, kVolumeFull);
getScenes()->loadSceneFromPosition(kCarGreenSleeping, 62);
getSound()->playSound(kEntityPlayer, "CAT1127A");
getSound()->playSoundEvent(kEntityPlayer, 15);
diff --git a/engines/lastexpress/game/inventory.cpp b/engines/lastexpress/game/inventory.cpp
index 622d547542..756ecda73f 100644
--- a/engines/lastexpress/game/inventory.cpp
+++ b/engines/lastexpress/game/inventory.cpp
@@ -159,7 +159,7 @@ void Inventory::handleMouseEvent(const Common::Event &ev) {
_portraitHighlighted = false;
_isOpened = false;
- getSound()->playSoundWithSubtitles("LIB039.SND", kFlagMenuClock, kEntityPlayer);
+ getSound()->playSoundWithSubtitles("LIB039.SND", kSoundTypeMenu | kSoundFlagFixedVolume | kVolumeFull, kEntityPlayer);
getMenu()->show(true, kSavegameTypeIndex, 0);
@@ -638,7 +638,7 @@ void Inventory::drawBlinkingEgg(uint ticks) {
if (globalTimer < 90) {
if ((globalTimer + ticks) >= 90)
- getSound()->playSoundWithSubtitles("TIMER", (SoundFlag)(kFlagType13|kFlagDefault), kEntityPlayer);
+ getSound()->playSoundWithSubtitles("TIMER", kSoundTypeMenu | kVolumeFull, kEntityPlayer);
if (!getSoundQueue()->isBuffered("TIMER"))
setGlobalTimer(0);
diff --git a/engines/lastexpress/game/scenes.cpp b/engines/lastexpress/game/scenes.cpp
index 367573733f..9aa85381ae 100644
--- a/engines/lastexpress/game/scenes.cpp
+++ b/engines/lastexpress/game/scenes.cpp
@@ -1137,7 +1137,7 @@ void SceneManager::postProcessScene() {
}
if (progress)
- getSound()->excuseMe((progress == 1) ? entities[0] : entities[rnd(progress)], kEntityPlayer, kFlagDefault);
+ getSound()->excuseMe((progress == 1) ? entities[0] : entities[rnd(progress)], kEntityPlayer, kVolumeFull);
}
if (hotspot->scene)
@@ -1163,7 +1163,7 @@ void SceneManager::postProcessScene() {
break;
getSoundQueue()->processEntry(kSoundType7);
- getSound()->playSound(kEntityTrain, "LIB050", kFlagDefault);
+ getSound()->playSound(kEntityTrain, "LIB050", kVolumeFull);
switch (getProgress().chapter) {
default:
diff --git a/engines/lastexpress/menu/menu.cpp b/engines/lastexpress/menu/menu.cpp
index 3a17cec6df..65680b3964 100644
--- a/engines/lastexpress/menu/menu.cpp
+++ b/engines/lastexpress/menu/menu.cpp
@@ -315,7 +315,7 @@ void Menu::show(bool doSavegame, SavegameType type, uint32 value) {
getFlags()->mouseRightClick = false;
// Play intro music
- getSound()->playSoundWithSubtitles("MUS001.SND", kFlagMusic, kEntityPlayer);
+ getSound()->playSoundWithSubtitles("MUS001.SND", kSoundTypeIntro | kVolumeFull, kEntityPlayer);
// Show The Smoking Car logo
if (animation.load(getArchive("1931.nis")))
@@ -326,7 +326,7 @@ void Menu::show(bool doSavegame, SavegameType type, uint32 value) {
} else {
// Only show the quick intro
if (!_hasShownStartScreen) {
- getSound()->playSoundWithSubtitles("MUS018.SND", kFlagMusic, kEntityPlayer);
+ getSound()->playSoundWithSubtitles("MUS018.SND", kSoundTypeIntro | kVolumeFull, kEntityPlayer);
getScenes()->loadScene(kSceneStartScreen);
// Original game waits 60 frames and loops Sound::unknownFunction1 unless the right button is pressed
@@ -1121,7 +1121,7 @@ void Menu::updateTime(uint32 time) {
if (getSoundQueue()->isBuffered(kEntityChapters))
getSoundQueue()->removeFromQueue(kEntityChapters);
- getSound()->playSoundWithSubtitles((_currentTime >= _time) ? "LIB042" : "LIB041", kFlagMenuClock, kEntityChapters);
+ getSound()->playSoundWithSubtitles((_currentTime >= _time) ? "LIB042" : "LIB041", kSoundTypeMenu | kSoundFlagFixedVolume | kVolumeFull, kEntityChapters);
adjustIndex(_currentTime, _time, false);
}
}
diff --git a/engines/lastexpress/shared.h b/engines/lastexpress/shared.h
index 8fc8059418..42a721677b 100644
--- a/engines/lastexpress/shared.h
+++ b/engines/lastexpress/shared.h
@@ -51,37 +51,111 @@ enum SoundType {
kSoundType16
};
+/*
+ These are the flags used by the original game
+ to keep track of sound entry status.
+
+ They are directly exposed via savefiles,
+ so we should be aware of them
+ even though we don't use some of them internally.
+
+ Sound playback is asynchronous.
+ We have threads and mutexes for synchronization,
+ DOS games have main code and IRQ/interrupt handlers instead,
+ some flags come in pairs to deal with this:
+ the main code sets kSoundFlagXxxRequested as a signal
+ to the interrupt handler, the interrupt handler processes it
+ (e.g. stops using the associated buffer for Close and Mute requests)
+ and sets the corresponding result flag. The main code can proceed then
+ (e.g. release the associated buffer).
+
+ The original game has a limited number of sound buffers (namely, 6)
+ (plus 16 versions of ADPCM decoder in assembly language,
+ one for every non-zero volume, so I suppose the performance was an issue).
+ The original game has also many events that could happen in different areas
+ of the train at the same time, some of them are synchronized via the sound
+ (kActionEndSound). To deal with it, the original game uses kSoundFlagMute:
+ muted sounds don't have their own buffer, don't participate in mixing the channels,
+ but the interrupt handler still tracks their progress.
+ Non-audible sounds (e.g. because the corresponding event goes on in another car)
+ are always muted; if the number of audible sounds exceeds the number of buffers,
+ least-priority sounds are muted as well (the priority is the sum of a static
+ constant from the entry constructor and the current volume).
+
+ Normally the sound duration is read from (one of the fields
+ in the header of) the associated file. However, if the sound entry
+ is started as muted, the buffer is not allocated and no data are read;
+ in this case, the duration is estimated from file size.
+ Since HPF archives store all sizes as counts of 0x800-byte blocks,
+ this loses some precision, but nothing to really care about.
+ If a started-as-muted sound is unmuted later (Cath enters the car
+ where a dialog takes place), the exact duration is loaded from the file;
+ kSoundFlagHeaderProcessed says that the duration is exact.
+
+ We have more sound channels available, we are not so limited
+ by the performance, and we lose some control of how exactly the backend
+ processes the sound as a payment for portability, so we can afford
+ to just mix the silence without special processing of muted entries.
+*/
enum SoundFlag {
- kFlagInvalid = -1,
- kFlagNone = 0x0,
- kFlag2 = 0x2,
- kFlag3 = 0x3,
- kFlag4 = 0x4,
- kFlag5 = 0x5,
- kFlag6 = 0x6,
- kFlag7 = 0x7,
- kFlag8 = 0x8,
- kFlag9 = 0x9,
- kFlag10 = 0xA,
- kFlag11 = 0xB,
- kFlag12 = 0xC,
- kFlag13 = 0xD,
- kFlag14 = 0xE,
- kFlag15 = 0xF,
- kFlagDefault = 0x10,
-
- kFlagType1_2 = 0x1000000,
- kFlagLoopedSound = 0x1001001,
- kFlagSteam = 0x1001007,
- kFlagType13 = 0x3000000,
- kFlagMenuClock = 0x3080010,
- kFlagType7 = 0x4000000,
- kFlagType11 = 0x5000000,
- kFlagMusic = 0x5000010,
- kFlagType3 = 0x6000000,
- kFlagLoop = 0x6001008,
- kFlagType9 = 0x7000000,
- kFlagNIS = 0x7002010
+ kSoundVolumeEntityDefault = 0xFFFFFFFF, // special value for SoundManager::playSound; choose volume based on distance to the entity
+
+ kVolumeNone = 0x0,
+ kVolume1 = 0x1,
+ kVolume2 = 0x2,
+ kVolume3 = 0x3,
+ kVolume4 = 0x4,
+ kVolume5 = 0x5,
+ kVolume6 = 0x6,
+ kVolume7 = 0x7,
+ kVolume8 = 0x8,
+ kVolume9 = 0x9,
+ kVolume10 = 0xA,
+ kVolume11 = 0xB,
+ kVolume12 = 0xC,
+ kVolume13 = 0xD,
+ kVolume14 = 0xE,
+ kVolume15 = 0xF,
+ kVolumeFull = 0x10,
+
+ kSoundVolumeMask = 0x1F,
+
+ kSoundFlagPlayRequested = 0x20,
+ kSoundFlagPlaying = 0x40, // IRQ handler has seen kSoundFlagPlayRequested and has started the playback
+ kSoundFlagMuteRequested = 0x80,
+ kSoundFlagMuteProcessed = 0x100, // IRQ handler has seen kSoundFlagMuteRequested
+ kSoundFlagMute = kSoundFlagMuteRequested | kSoundFlagMuteProcessed,
+ kSoundFlagCloseRequested = 0x200, // close requested, waiting for IRQ handler to confirm
+ kSoundFlagClosed = 0x400, // IRQ handler has seen kSoundFlagClosing and is completely done with this sound
+ kSoundFlagCloseOnDataEnd = 0x800, // used as the opposite of kSoundFlagLooped
+ kSoundFlagLooped = 0x1000,
+ kSoundFlagCyclicBuffer = 0x2000, // when the decoder reaches the end of buffer, the decoder should continue from the beginning of buffer
+ kSoundFlagHasUnreadData = 0x4000, // stream has more data
+ kSoundFlagDelayedActivate = 0x8000, // start playing at _activateTime
+ kSoundFlagHasLinkAfter = 0x10000, // _linkAfter is valid and should be activated after this sound; used by xxx.NIS sounds for xxx.LNK
+ kSoundFlagHasSubtitles = 0x20000,
+ kSoundFlagPaused = 0x40000, // IRQ handler has seen kSoundFlagPauseRequested and does not use the buffer anymore
+ kSoundFlagFixedVolume = 0x80000, // Turns off the logic of volume adjusting for entity-related sounds when distance to entity is changed
+ kSoundFlagVolumeChanging = 0x100000, // smooth changing of the volume is in progress
+ kSoundFlagHeaderProcessed = 0x200000, // count of blocks is the accurate value from the header
+ kSoundFlagPauseRequested = 0x400000, // used when the reader needs to change the buffer
+ kSoundFlagDecodeStall = 0x800000, // the decoder has stopped because the reader is too slow and has not yet provided further data
+
+ kSoundTypeNormal = 0x0000000, // everything not included in any specific category
+ kSoundTypeAmbient = 0x1000000, // train sounds, steam, wind, restaurant sounds
+ kSoundTypeConcert = 0x2000000, // 1917.LNK
+ kSoundTypeMenu = 0x3000000, // menu screen, blinking egg after time travel; excluded from savefiles
+ kSoundTypeLink = 0x4000000, // xxx.LNK linked after NIS sound, except for 1917.LNK
+ kSoundTypeIntro = 0x5000000, // intro at game start before showing the menu
+ kSoundTypeWalla = 0x6000000, // LOOP8A.SND by kEntityTables2
+ kSoundTypeNIS = 0x7000000, // special entry managed by NIS code
+
+ kSoundTypeMask = 0x7000000,
+
+ kSoundFlagKeepAfterFinish = 0x8000000, // don't free the entry when it has stopped playing; used for kSoundTypeNIS
+ kSoundFlagDecodeError = 0x20000000, // error in compressed stream
+ kSoundFlagFading = 0x40000000, // prevents attempts to unfade once fade is requested
+ kSoundFlagUnmuteRequested = 0x80000000, // purely informational
};
enum SoundState {
@@ -90,24 +164,6 @@ enum SoundState {
kSoundState2 = 2
};
-enum SoundStatus {
- kSoundStatusClear0 = 0x10,
- kSoundStatusFilter = 0x1F,
- kSoundStatus_20 = 0x20,
- kSoundStatus_40 = 0x40,
- kSoundStatusCached = 0x80,
- kSoundStatus_180 = 0x180,
- kSoundStatusClosed = 0x200,
- kSoundStatus_400 = 0x400,
- kSoundStatusClear4 = 0x800,
- kSoundStatus_8000 = 0x8000,
- kSoundStatus_20000 = 0x20000,
- kSoundStatus_100000 = 0x100000,
- kSoundStatus_20000000 = 0x20000000,
- kSoundStatus_40000000 = 0x40000000,
- kSoundStatusClearAll = 0xFFFFFFE0
-};
-
//////////////////////////////////////////////////////////////////////////
// Time values
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/lastexpress/sound/entry.cpp b/engines/lastexpress/sound/entry.cpp
index a8c9b22cd4..945fc2318b 100644
--- a/engines/lastexpress/sound/entry.cpp
+++ b/engines/lastexpress/sound/entry.cpp
@@ -42,6 +42,7 @@ namespace LastExpress {
// SoundEntry
//////////////////////////////////////////////////////////////////////////
SoundEntry::SoundEntry(LastExpressEngine *engine) : _engine(engine) {
+ _status = 0;
_type = kSoundTypeNone;
_currentDataPtr = NULL;
@@ -90,10 +91,10 @@ void SoundEntry::open(Common::String name, SoundFlag flag, int priority) {
}
void SoundEntry::close() {
- _status.status |= kSoundStatusClosed;
+ _status |= kSoundFlagCloseRequested;
// Loop until ready
- //while (!(_status.b.status1 & 4) && !(getSoundQueue()->getFlag() & 8) && (getSoundQueue()->getFlag() & 1))
+ //while (!(_status & kSoundFlagClosed) && !(getSoundQueue()->getFlag() & 8) && (getSoundQueue()->getFlag() & 1))
// ; // empty loop body
// The original game remove the entry from the cache here,
@@ -123,7 +124,7 @@ void SoundEntry::play() {
_soundStream = new StreamedSound();
// Compute current filter id
- int32 filterId = _status.status & kSoundStatusFilter;
+ int32 filterId = _status & kSoundVolumeMask;
// TODO adjust status (based on stepIndex)
if (_queued) {
@@ -150,14 +151,14 @@ bool SoundEntry::isFinished() {
}
void SoundEntry::setType(SoundFlag flag) {
- switch (flag & kFlagType9) {
+ switch (flag & kSoundTypeMask) {
default:
- case kFlagNone:
+ case kSoundTypeNormal:
_type = getSoundQueue()->getCurrentType();
getSoundQueue()->setCurrentType((SoundType)(_type + 1));
break;
- case kFlagType1_2: {
+ case kSoundTypeAmbient: {
SoundEntry *previous2 = getSoundQueue()->getEntry(kSoundType2);
if (previous2)
previous2->update(0);
@@ -172,7 +173,7 @@ void SoundEntry::setType(SoundFlag flag) {
}
break;
- case kFlagType3: {
+ case kSoundTypeWalla: {
SoundEntry *previous = getSoundQueue()->getEntry(kSoundType3);
if (previous) {
previous->setType(kSoundType4);
@@ -183,7 +184,7 @@ void SoundEntry::setType(SoundFlag flag) {
}
break;
- case kFlagType7: {
+ case kSoundTypeLink: {
SoundEntry *previous = getSoundQueue()->getEntry(kSoundType7);
if (previous)
previous->setType(kSoundType8);
@@ -192,7 +193,7 @@ void SoundEntry::setType(SoundFlag flag) {
}
break;
- case kFlagType9: {
+ case kSoundTypeNIS: {
SoundEntry *previous = getSoundQueue()->getEntry(kSoundType9);
if (previous)
previous->setType(kSoundType10);
@@ -201,7 +202,7 @@ void SoundEntry::setType(SoundFlag flag) {
}
break;
- case kFlagType11: {
+ case kSoundTypeIntro: {
SoundEntry *previous = getSoundQueue()->getEntry(kSoundType11);
if (previous)
previous->setType(kSoundType14);
@@ -210,7 +211,7 @@ void SoundEntry::setType(SoundFlag flag) {
}
break;
- case kFlagType13: {
+ case kSoundTypeMenu: {
SoundEntry *previous = getSoundQueue()->getEntry(kSoundType13);
if (previous)
previous->setType(kSoundType14);
@@ -222,14 +223,12 @@ void SoundEntry::setType(SoundFlag flag) {
}
void SoundEntry::setupStatus(SoundFlag flag) {
- SoundStatus statusFlag = (SoundStatus)flag;
- if (!((statusFlag & 0xFF) & kSoundStatusFilter))
- statusFlag = (SoundStatus)(statusFlag | kSoundStatusCached);
-
- if (((statusFlag & 0xFF00) >> 8) & kSoundStatusClear0)
- _status.status = (uint32)statusFlag;
- else
- _status.status = (statusFlag | kSoundStatusClear4);
+ _status = flag;
+ if ((_status & kSoundVolumeMask) == kVolumeNone)
+ _status |= kSoundFlagMuteRequested;
+
+ if (!(_status & kSoundFlagLooped))
+ _status |= kSoundFlagCloseOnDataEnd;
}
void SoundEntry::loadStream(Common::String name) {
@@ -242,26 +241,27 @@ void SoundEntry::loadStream(Common::String name) {
_stream = getArchive("DEFAULT.SND");
if (!_stream)
- _status.status = kSoundStatusClosed;
+ _status = kSoundFlagCloseRequested;
}
void SoundEntry::update(uint val) {
- if (!(_status.b.status3 & 64)) {
- int value2 = val;
+ if (_status & kSoundFlagFading)
+ return;
- _status.status |= kSoundStatus_100000;
+ int value2 = val;
- if (val) {
- if (getSoundQueue()->getFlag() & 32) {
- _variant = val;
- value2 = val * 2 + 1;
- }
+ _status |= kSoundFlagVolumeChanging;
- _field_3C = value2;
- } else {
- _field_3C = 0;
- _status.status |= kSoundStatus_40000000;
+ if (val) {
+ if (getSoundQueue()->getFlag() & 32) {
+ _variant = val;
+ value2 = val * 2 + 1;
}
+
+ _field_3C = value2;
+ } else {
+ _field_3C = 0;
+ _status |= kSoundFlagFading;
}
}
@@ -271,13 +271,13 @@ bool SoundEntry::updateSound() {
bool result;
char sub[16];
- if (_status.b.status2 & 4) {
+ if (_status & kSoundFlagClosed) {
result = false;
} else {
- if (_status.b.status2 & 0x80) {
+ if (_status & kSoundFlagDelayedActivate) {
if (_field_48 <= getSound()->getData2()) {
- _status.status |= 0x20;
- _status.status &= ~0x8000;
+ _status |= kSoundFlagPlayRequested;
+ _status &= ~kSoundFlagDelayedActivate;
strcpy(sub, _name2.c_str());
// FIXME: Rewrite and document expected behavior
@@ -288,7 +288,7 @@ bool SoundEntry::updateSound() {
}
} else {
if (!(getSoundQueue()->getFlag() & 0x20)) {
- if (!(_status.b.status3 & 8)) {
+ if (!(_status & kSoundFlagFixedVolume)) {
if (_entity) {
if (_entity < 0x80) {
updateEntryFlag(getSound()->getSoundFlag(_entity));
@@ -296,7 +296,7 @@ bool SoundEntry::updateSound() {
}
}
}
- //if (status.b.status2 & 0x40 && !((uint32)_status.status & 0x180) && v1->soundBuffer)
+ //if (_status & kSoundFlagHasUnreadData && !(_status & kSoundFlagMute) && v1->soundBuffer)
// Sound_FillSoundBuffer(v1);
}
result = true;
@@ -310,31 +310,31 @@ void SoundEntry::updateEntryFlag(SoundFlag flag) {
if (getSoundQueue()->getFlag() & 0x20 && _type != kSoundType9 && _type != kSoundType7)
update(flag);
else
- _status.status = flag + (_status.status & ~0x1F);
+ _status = flag + (_status & ~kSoundVolumeMask);
} else {
_variant = 0;
- _status.status |= 0x80u;
- _status.status &= ~0x10001F;
+ _status |= kSoundFlagMuteRequested;
+ _status &= ~(kSoundFlagVolumeChanging | kSoundVolumeMask);
}
}
void SoundEntry::updateState() {
if (getSoundQueue()->getFlag() & 32) {
if (_type != kSoundType9 && _type != kSoundType7 && _type != kSoundType5) {
- uint32 variant = _status.status & kSoundStatusFilter;
+ uint32 variant = _status & kSoundVolumeMask;
- _status.status &= kSoundStatusClearAll;
+ _status &= ~kSoundVolumeMask;
_variant = variant;
- _status.status |= variant * 2 + 1;
+ _status |= variant * 2 + 1;
}
}
- _status.status |= kSoundStatus_20;
+ _status |= kSoundFlagPlayRequested;
}
void SoundEntry::reset() {
- _status.status |= kSoundStatusClosed;
+ _status |= kSoundFlagCloseRequested;
_entity = kEntityPlayer;
if (_stream) {
@@ -354,11 +354,11 @@ void SoundEntry::showSubtitle(Common::String filename) {
_subtitle = new SubtitleEntry(_engine);
_subtitle->load(filename, this);
- if (_subtitle->getStatus().b.status2 & 4) {
+ if (_subtitle->getStatus() & 0x400) {
_subtitle->draw();
SAFE_DELETE(_subtitle);
} else {
- _status.status |= kSoundStatus_20000;
+ _status |= kSoundFlagHasSubtitles;
}
}
@@ -366,8 +366,8 @@ void SoundEntry::saveLoadWithSerializer(Common::Serializer &s) {
assert(_name1.size() <= 16);
assert(_name2.size() <= 16);
- if (_name2.matchString("NISSND?") && ((_status.status & kFlagType9) != kFlagType13)) {
- s.syncAsUint32LE(_status.status);
+ if (_name2.matchString("NISSND?") && ((_status & kSoundTypeMask) != kSoundTypeMenu)) {
+ s.syncAsUint32LE(_status);
s.syncAsUint32LE(_type);
s.syncAsUint32LE(_blockCount); // field_8;
s.syncAsUint32LE(_time);
@@ -396,6 +396,7 @@ void SoundEntry::saveLoadWithSerializer(Common::Serializer &s) {
// SubtitleEntry
//////////////////////////////////////////////////////////////////////////
SubtitleEntry::SubtitleEntry(LastExpressEngine *engine) : _engine(engine) {
+ _status = 0;
_sound = NULL;
_data = NULL;
}
@@ -423,7 +424,7 @@ void SubtitleEntry::load(Common::String filename, SoundEntry *soundEntry) {
loadData();
} else {
- _status.status = kSoundStatus_400;
+ _status = kSoundFlagClosed;
}
}
@@ -445,7 +446,7 @@ void SubtitleEntry::setupAndDraw() {
}
if (_data->getMaxTime() > _sound->getTime()) {
- _status.status = kSoundStatus_400;
+ _status = kSoundFlagClosed;
} else {
_data->setTime((uint16)_sound->getTime());
diff --git a/engines/lastexpress/sound/entry.h b/engines/lastexpress/sound/entry.h
index 0ebe550a02..4769d83d47 100644
--- a/engines/lastexpress/sound/entry.h
+++ b/engines/lastexpress/sound/entry.h
@@ -76,21 +76,6 @@ namespace LastExpress {
class LastExpressEngine;
class SubtitleEntry;
-// TODO: this union assumes little-endian machine
-union SoundStatusUnion {
- uint32 status;
- struct {
- byte status1;
- byte status2;
- byte status3;
- byte status4;
- } b;
-
- SoundStatusUnion() {
- status = 0;
- }
-};
-
//////////////////////////////////////////////////////////////////////////
// SoundEntry
//////////////////////////////////////////////////////////////////////////
@@ -116,12 +101,12 @@ public:
void saveLoadWithSerializer(Common::Serializer &ser);
// Accessors
- void setStatus(int status) { _status.status = status; }
+ void setStatus(uint32 status) { _status = status; }
void setType(SoundType type) { _type = type; }
void setEntity(EntityIndex entity) { _entity = entity; }
void setField48(int val) { _field_48 = val; }
- SoundStatusUnion getStatus() { return _status; }
+ uint32 getStatus() { return _status; }
SoundType getType() { return _type; }
uint32 getTime() { return _time; }
EntityIndex getEntity() { return _entity; }
@@ -134,7 +119,10 @@ public:
private:
LastExpressEngine *_engine;
- SoundStatusUnion _status;
+ // _status field is a combination of bits from SoundFlag; writing
+ // _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;
@@ -182,14 +170,14 @@ public:
void drawOnScreen();
// Accessors
- SoundStatusUnion getStatus() { return _status; }
+ uint32 getStatus() { return _status; }
SoundEntry *getSoundEntry() { return _sound; }
private:
LastExpressEngine *_engine;
Common::String _filename;
- SoundStatusUnion _status;
+ uint32 _status;
SoundEntry *_sound;
SubtitleManager *_data;
};
diff --git a/engines/lastexpress/sound/queue.cpp b/engines/lastexpress/sound/queue.cpp
index a088da319f..84b6e69c18 100644
--- a/engines/lastexpress/sound/queue.cpp
+++ b/engines/lastexpress/sound/queue.cpp
@@ -132,7 +132,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().b.status3 & 0x8)) {
+ if (!entry->updateSound() && !(entry->getStatus() & kSoundFlagKeepAfterFinish)) {
entry->close();
SAFE_DELETE(entry);
it = _soundList.reverse_erase(it);
@@ -203,7 +203,7 @@ void SoundQueue::clearStatus() {
Common::StackLock locker(_mutex);
for (Common::List<SoundEntry *>::iterator i = _soundList.begin(); i != _soundList.end(); ++i)
- (*i)->setStatus((*i)->getStatus().status | kSoundStatusClosed);
+ (*i)->setStatus((*i)->getStatus() | kSoundFlagCloseRequested);
}
//////////////////////////////////////////////////////////////////////////
@@ -321,16 +321,16 @@ void SoundQueue::updateSubtitles() {
for (Common::List<SubtitleEntry *>::iterator i = _subtitles.begin(); i != _subtitles.end(); ++i) {
uint32 current_index = 0;
SoundEntry *soundEntry = (*i)->getSoundEntry();
- SoundStatus status = (SoundStatus)soundEntry->getStatus().status;
+ SoundFlag status = (SoundFlag)soundEntry->getStatus();
- if (!(status & kSoundStatus_40)
- || status & kSoundStatus_180
+ if (!(status & kSoundFlagPlaying)
+ || status & kSoundFlagMute
|| soundEntry->getTime() == 0
- || (status & kSoundStatusFilter) < 6
+ || (status & kSoundVolumeMask) < kVolume6
|| ((getFlags()->nis & 0x8000) && soundEntry->getPriority() < 90)) {
current_index = 0;
} else {
- current_index = soundEntry->getPriority() + (status & kSoundStatusFilter);
+ current_index = soundEntry->getPriority() + (status & kSoundVolumeMask);
if (_currentSubtitle == (*i))
current_index += 4;
diff --git a/engines/lastexpress/sound/sound.cpp b/engines/lastexpress/sound/sound.cpp
index ca79915c66..a226250956 100644
--- a/engines/lastexpress/sound/sound.cpp
+++ b/engines/lastexpress/sound/sound.cpp
@@ -96,20 +96,20 @@ static const char *const locomotiveSounds[5] = {
};
static const SoundFlag soundFlags[32] = {
- kFlagDefault,
- kFlag15,
- kFlag14,
- kFlag13,
- kFlag12,
- kFlag11, kFlag11,
- kFlag10, kFlag10,
- kFlag9, kFlag9,
- kFlag8, kFlag8,
- kFlag7, kFlag7, kFlag7,
- kFlag6, kFlag6, kFlag6,
- kFlag5, kFlag5, kFlag5, kFlag5,
- kFlag4, kFlag4, kFlag4, kFlag4,
- kFlag3, kFlag3, kFlag3, kFlag3, kFlag3
+ kVolumeFull,
+ kVolume15,
+ kVolume14,
+ kVolume13,
+ kVolume12,
+ kVolume11, kVolume11,
+ kVolume10, kVolume10,
+ kVolume9, kVolume9,
+ kVolume8, kVolume8,
+ kVolume7, kVolume7, kVolume7,
+ kVolume6, kVolume6, kVolume6,
+ kVolume5, kVolume5, kVolume5, kVolume5,
+ kVolume4, kVolume4, kVolume4, kVolume4,
+ kVolume3, kVolume3, kVolume3, kVolume3, kVolume3
};
SoundManager::SoundManager(LastExpressEngine *engine) : _engine(engine) {
@@ -150,15 +150,15 @@ void SoundManager::playSound(EntityIndex entity, Common::String filename, SoundF
getSavePoints()->push(kEntityPlayer, entity, kActionEndSound);
}
-bool SoundManager::playSoundWithSubtitles(Common::String filename, SoundFlag flag, EntityIndex entity, byte a4) {
+bool SoundManager::playSoundWithSubtitles(Common::String filename, uint32 flag, EntityIndex entity, byte a4) {
SoundEntry *entry = new SoundEntry(_engine);
- entry->open(filename, flag, 30);
+ entry->open(filename, (SoundFlag)flag, 30);
entry->setEntity(entity);
if (a4) {
entry->setField48(_data2 + 2 * a4);
- entry->setStatus(entry->getStatus().status | kSoundStatus_8000);
+ entry->setStatus(entry->getStatus() | kSoundFlagDelayedActivate);
} else {
// Get subtitles name
uint32 size = filename.size();
@@ -308,7 +308,7 @@ void SoundManager::playSteam(CityIndex index) {
_queue->resetState(kSoundState2);
if (!_queue->getEntry(kSoundType1))
- playSoundWithSubtitles("STEAM.SND", kFlagSteam, kEntitySteam);
+ playSoundWithSubtitles("STEAM.SND", kSoundTypeAmbient | kSoundFlagLooped | kVolume7, kEntitySteam);
// Get the new sound entry and show subtitles
SoundEntry *entry = _queue->getEntry(kSoundType1);
@@ -357,7 +357,7 @@ void SoundManager::playFightSound(byte action, byte a4) {
}
if (_action)
- playSound(kEntityTrain, Common::String::format("LIB%03d.SND", _action), kFlagDefault, a4);
+ playSound(kEntityTrain, Common::String::format("LIB%03d.SND", _action), kVolumeFull, a4);
}
void SoundManager::playDialog(EntityIndex entity, EntityIndex entityDialog, SoundFlag flag, byte a4) {
@@ -691,7 +691,7 @@ void SoundManager::readText(int id) {
if (_queue->isBuffered(text))
_queue->removeFromQueue(text);
- playSound(kEntityTables4, text, kFlagDefault);
+ playSound(kEntityTables4, text, kVolumeFull);
}
//////////////////////////////////////////////////////////////////////////
@@ -702,14 +702,14 @@ void SoundManager::playWarningCompartment(EntityIndex entity, ObjectIndex compar
#define PLAY_WARNING(index, sound1, sound2, sound3, sound4, sound5, sound6) { \
if (_lastWarning[index] + 450 >= getState()->timeTicks) { \
if (rnd(2)) \
- playSound(kEntityMertens, sound1, kFlagDefault); \
+ playSound(kEntityMertens, sound1, kVolumeFull); \
else \
- playSound(kEntityMertens, rnd(2) ? sound2 : sound3, kFlagDefault); \
+ playSound(kEntityMertens, rnd(2) ? sound2 : sound3, kVolumeFull); \
} else { \
if (rnd(2)) \
- playSound(kEntityMertens, sound4, kFlagDefault); \
+ playSound(kEntityMertens, sound4, kVolumeFull); \
else \
- playSound(kEntityMertens, rnd(2) ? sound5 : sound6, kFlagDefault); \
+ playSound(kEntityMertens, rnd(2) ? sound5 : sound6, kVolumeFull); \
} \
_lastWarning[index] = getState()->timeTicks; \
}
@@ -748,15 +748,15 @@ void SoundManager::playWarningCompartment(EntityIndex entity, ObjectIndex compar
break;
case 1:
- getSound()->playSound(kEntityMertens, "Con1503C", kFlagDefault);
+ getSound()->playSound(kEntityMertens, "Con1503C", kVolumeFull);
break;
case 2:
- getSound()->playSound(kEntityMertens, rnd(2) ? "Con1503E" : "Con1503A", kFlagDefault);
+ getSound()->playSound(kEntityMertens, rnd(2) ? "Con1503E" : "Con1503A", kVolumeFull);
break;
case 3:
- getSound()->playSound(kEntityMertens, rnd(2) ? "Con1503B" : "Con1503D", kFlagDefault);
+ getSound()->playSound(kEntityMertens, rnd(2) ? "Con1503B" : "Con1503D", kVolumeFull);
_lastWarning[3] = 0;
break;
}
@@ -773,83 +773,83 @@ void SoundManager::playWarningCompartment(EntityIndex entity, ObjectIndex compar
case kObjectCompartmentA:
if (_lastWarning[4] + 450 >= getState()->timeTicks) {
- getSound()->playSound(kEntityCoudert, rnd(2) ? "Jac1500" : "Jac1500A", kFlagDefault);
+ getSound()->playSound(kEntityCoudert, rnd(2) ? "Jac1500" : "Jac1500A", kVolumeFull);
break;
}
- getSound()->playSound(kEntityCoudert, rnd(2) ? "Jac1508" : "Jac1508A", kFlagDefault);
+ getSound()->playSound(kEntityCoudert, rnd(2) ? "Jac1508" : "Jac1508A", kVolumeFull);
break;
case kObjectCompartmentB:
if (_lastWarning[5] + 450 >= getState()->timeTicks) {
- getSound()->playSound(kEntityCoudert, rnd(2) ? "Jac1500" : "Jac1500A", kFlagDefault);
+ getSound()->playSound(kEntityCoudert, rnd(2) ? "Jac1500" : "Jac1500A", kVolumeFull);
break;
}
if (getProgress().field_40 || (getState()->time > kTimeCityLinz && getState()->time < kTime2133000))
- getSound()->playSound(kEntityCoudert, "Jac1507A", kFlagDefault);
+ getSound()->playSound(kEntityCoudert, "Jac1507A", kVolumeFull);
else
- getSound()->playSound(kEntityCoudert, "Jac1507", kFlagDefault);
+ getSound()->playSound(kEntityCoudert, "Jac1507", kVolumeFull);
break;
case kObjectCompartmentC:
if (_lastWarning[6] + 450 >= getState()->timeTicks) {
- getSound()->playSound(kEntityCoudert, rnd(2) ? "Jac1500" : "Jac1500A", kFlagDefault);
+ getSound()->playSound(kEntityCoudert, rnd(2) ? "Jac1500" : "Jac1500A", kVolumeFull);
break;
}
if (getProgress().chapter < kChapter3)
- getSound()->playSound(kEntityCoudert, "Jac1506", kFlagDefault);
+ getSound()->playSound(kEntityCoudert, "Jac1506", kVolumeFull);
else
- getSound()->playSound(kEntityCoudert, rnd(2) ? "Jac1506A" : "Jac1506B", kFlagDefault);
+ getSound()->playSound(kEntityCoudert, rnd(2) ? "Jac1506A" : "Jac1506B", kVolumeFull);
break;
case kObjectCompartmentD:
if (_lastWarning[7] + 450 >= getState()->timeTicks) {
- getSound()->playSound(kEntityCoudert, rnd(2) ? "Jac1500" : "Jac1500A", kFlagDefault);
+ getSound()->playSound(kEntityCoudert, rnd(2) ? "Jac1500" : "Jac1500A", kVolumeFull);
break;
}
- getSound()->playSound(kEntityCoudert, "Jac1505", kFlagDefault);
+ getSound()->playSound(kEntityCoudert, "Jac1505", kVolumeFull);
break;
case kObjectCompartmentE:
if (_lastWarning[8] + 450 >= getState()->timeTicks) {
- getSound()->playSound(kEntityCoudert, rnd(2) ? "Jac1500" : "Jac1500A", kFlagDefault);
+ getSound()->playSound(kEntityCoudert, rnd(2) ? "Jac1500" : "Jac1500A", kVolumeFull);
break;
}
if (getProgress().field_40 || (getState()->time > kTime2115000 && getState()->time < kTime2133000)) {
- getSound()->playSound(kEntityCoudert, "Jac1504B", kFlagDefault);
+ getSound()->playSound(kEntityCoudert, "Jac1504B", kVolumeFull);
break;
}
if (getEntities()->isInsideCompartment(kEntityRebecca, kCarRedSleeping, kPosition_4840))
- getSound()->playSound(kEntityCoudert, rnd(2) ? "Jac1500" : "Jac1500A", kFlagDefault);
+ getSound()->playSound(kEntityCoudert, rnd(2) ? "Jac1500" : "Jac1500A", kVolumeFull);
else
- getSound()->playSound(kEntityCoudert, rnd(2) ? "Jac1504" : "Jac1504A", kFlagDefault);
+ getSound()->playSound(kEntityCoudert, rnd(2) ? "Jac1504" : "Jac1504A", kVolumeFull);
break;
case kObjectCompartmentF:
if (_lastWarning[9] + 450 >= getState()->timeTicks) {
- getSound()->playSound(kEntityCoudert, rnd(2) ? "Jac1500" : "Jac1500A", kFlagDefault);
+ getSound()->playSound(kEntityCoudert, rnd(2) ? "Jac1500" : "Jac1500A", kVolumeFull);
break;
}
if (getProgress().field_40 || (getState()->time > kTime2083500 && getState()->time < kTime2133000)) {
- getSound()->playSound(kEntityCoudert, "Jac1503B", kFlagDefault);
+ getSound()->playSound(kEntityCoudert, "Jac1503B", kVolumeFull);
break;
}
if (rnd(2) || getEntities()->isInsideCompartment(kEntityAnna, kCarRedSleeping, kPosition_4070))
- getSound()->playSound(kEntityCoudert, "Jac1503A", kFlagDefault);
+ getSound()->playSound(kEntityCoudert, "Jac1503A", kVolumeFull);
else
- getSound()->playSound(kEntityCoudert, "Jac1503", kFlagDefault);
+ getSound()->playSound(kEntityCoudert, "Jac1503", kVolumeFull);
break;
case kObjectCompartmentG:
if (_lastWarning[10] + 450 >= getState()->timeTicks) {
- getSound()->playSound(kEntityCoudert, rnd(2) ? "Jac1500" : "Jac1500A", kFlagDefault);
+ getSound()->playSound(kEntityCoudert, rnd(2) ? "Jac1500" : "Jac1500A", kVolumeFull);
break;
}
@@ -858,21 +858,21 @@ void SoundManager::playWarningCompartment(EntityIndex entity, ObjectIndex compar
// Jac1502 is a generic response,
// so Coudert only says "Milos is not in" when Milos is actually in.
if (rnd(2) || getEntities()->isInsideCompartment(kEntityMilos, kCarRedSleeping, kPosition_3050))
- getSound()->playSound(kEntityCoudert, "Jac1502", kFlagDefault);
+ getSound()->playSound(kEntityCoudert, "Jac1502", kVolumeFull);
else
- getSound()->playSound(kEntityCoudert, "Jac1502A", kFlagDefault);
+ getSound()->playSound(kEntityCoudert, "Jac1502A", kVolumeFull);
break;
case kObjectCompartmentH:
if (_lastWarning[11] + 450 >= getState()->timeTicks) {
- getSound()->playSound(kEntityCoudert, rnd(2) ? "Jac1500" : "Jac1500A", kFlagDefault);
+ getSound()->playSound(kEntityCoudert, rnd(2) ? "Jac1500" : "Jac1500A", kVolumeFull);
break;
}
if (getEntities()->isInsideCompartment(kEntityIvo, kCarRedSleeping, kPosition_2740))
- getSound()->playSound(kEntityCoudert, rnd(2) ? "Jac1500" : "Jac1500A", kFlagDefault);
+ getSound()->playSound(kEntityCoudert, rnd(2) ? "Jac1500" : "Jac1500A", kVolumeFull);
else
- getSound()->playSound(kEntityCoudert, "Jac1501", kFlagDefault);
+ getSound()->playSound(kEntityCoudert, "Jac1501", kVolumeFull);
break;
}
@@ -890,7 +890,7 @@ void SoundManager::excuseMe(EntityIndex entity, EntityIndex entity2, SoundFlag f
if (entity == kEntityFrancois && getEntityData(kEntityFrancois)->field_4A3 != 30)
return;
- if (flag == kFlagNone)
+ if (flag == kVolumeNone)
flag = getSoundFlag(entity);
switch (entity) {
@@ -1232,13 +1232,13 @@ const char *SoundManager::justAMinuteCath() const {
//////////////////////////////////////////////////////////////////////////
SoundFlag SoundManager::getSoundFlag(EntityIndex entity) const {
if (entity == kEntityPlayer)
- return kFlagDefault;
+ return kVolumeFull;
if (getEntityData(entity)->car != getEntityData(kEntityPlayer)->car)
- return kFlagNone;
+ return kVolumeNone;
// Compute sound value
- SoundFlag ret = kFlag2;
+ SoundFlag ret = kVolume2;
// Get default value if valid
int index = ABS(getEntityData(entity)->entityPosition - getEntityData(kEntityPlayer)->entityPosition) / 230;
@@ -1249,7 +1249,7 @@ SoundFlag SoundManager::getSoundFlag(EntityIndex entity) const {
if (getEntityData(kEntityPlayer)->car != kCarKronos
&& !getEntities()->isOutsideAlexeiWindow()
&& !getEntities()->isOutsideAnnaWindow())
- return kFlagNone;
+ return kVolumeNone;
return (SoundFlag)(ret / 6);
}
@@ -1371,7 +1371,7 @@ void SoundManager::playLoopingSound(int param) {
_loopingSoundDuration = _engine->getRandom().getRandomNumber(319) + 260;
if (partNumber != 99) {
- playSoundWithSubtitles(tmp, kFlagLoopedSound, kEntitySteam);
+ playSoundWithSubtitles(tmp, kSoundTypeAmbient | kSoundFlagLooped | kVolume1, kEntitySteam);
if (entry)
entry->update(0);
diff --git a/engines/lastexpress/sound/sound.h b/engines/lastexpress/sound/sound.h
index 81f1529286..f8e826a333 100644
--- a/engines/lastexpress/sound/sound.h
+++ b/engines/lastexpress/sound/sound.h
@@ -38,8 +38,8 @@ public:
~SoundManager();
// Sound playing
- void playSound(EntityIndex entity, Common::String filename, SoundFlag flag = kFlagInvalid, byte a4 = 0);
- bool playSoundWithSubtitles(Common::String filename, SoundFlag flag, EntityIndex entity, byte a4 = 0);
+ void playSound(EntityIndex entity, Common::String filename, SoundFlag flag = kSoundVolumeEntityDefault, byte a4 = 0);
+ bool playSoundWithSubtitles(Common::String filename, uint32 flag, EntityIndex entity, byte a4 = 0);
void playSoundEvent(EntityIndex entity, byte action, byte a3 = 0);
void playDialog(EntityIndex entity, EntityIndex entityDialog, SoundFlag flag, byte a4);
void playSteam(CityIndex index);
@@ -53,7 +53,7 @@ public:
const char *getDialogName(EntityIndex entity) const;
// Sound bites
- void excuseMe(EntityIndex entity, EntityIndex entity2 = kEntityPlayer, SoundFlag flag = kFlagNone);
+ void excuseMe(EntityIndex entity, EntityIndex entity2 = kEntityPlayer, SoundFlag flag = kVolumeNone);
void excuseMeCath();
const char *justCheckingCath() const;
const char *wrongDoorCath() const;