aboutsummaryrefslogtreecommitdiff
path: root/engines/lastexpress/game
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/game
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/game')
-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
4 files changed, 15 insertions, 15 deletions
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: