diff options
Diffstat (limited to 'engines/lastexpress/entities')
37 files changed, 414 insertions, 352 deletions
diff --git a/engines/lastexpress/entities/abbot.cpp b/engines/lastexpress/entities/abbot.cpp index 29bb31b248..c5c6f2a44d 100644 --- a/engines/lastexpress/entities/abbot.cpp +++ b/engines/lastexpress/entities/abbot.cpp @@ -31,9 +31,11 @@ #include "lastexpress/game/object.h" #include "lastexpress/game/savepoint.h" #include "lastexpress/game/scenes.h" -#include "lastexpress/game/sound.h" #include "lastexpress/game/state.h" +#include "lastexpress/sound/queue.h" +#include "lastexpress/sound/sound.h" + #include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" @@ -1112,7 +1114,7 @@ IMPLEMENT_FUNCTION(35, Abbot, function35) case 2: getData()->location = kLocationOutsideCompartment; - getSound()->playSound(kEntityAbbot, "Abb3040", SoundManager::kFlagInvalid, 45); + getSound()->playSound(kEntityAbbot, "Abb3040", kFlagInvalid, 45); getEntities()->updatePositionEnter(kEntityAbbot, kCarRestaurant, 57); setCallback(3); @@ -1409,7 +1411,7 @@ IMPLEMENT_FUNCTION(43, Abbot, function43) setup_playSound("Abb4002"); break; } else { - if (!getEntities()->isDistanceBetweenEntities(kEntityAbbot, kEntityPlayer, 1000) || getSound()->isBuffered(kEntityBoutarel) || !params->param4) + if (!getEntities()->isDistanceBetweenEntities(kEntityAbbot, kEntityPlayer, 1000) || getSoundQueue()->isBuffered(kEntityBoutarel) || !params->param4) params->param4 = (uint)getState()->time + 450; if (params->param4 < getState()->time) { @@ -1754,7 +1756,7 @@ IMPLEMENT_FUNCTION(49, Abbot, pickBomb) break; case kActionKnock: - if (!getSound()->isBuffered("LIB012", true)) + if (!getSoundQueue()->isBuffered("LIB012", true)) getSound()->playSound(kEntityPlayer, "LIB012"); break; diff --git a/engines/lastexpress/entities/alexei.cpp b/engines/lastexpress/entities/alexei.cpp index d723a5607c..073ca3f175 100644 --- a/engines/lastexpress/entities/alexei.cpp +++ b/engines/lastexpress/entities/alexei.cpp @@ -29,9 +29,10 @@ #include "lastexpress/game/object.h" #include "lastexpress/game/savepoint.h" #include "lastexpress/game/scenes.h" -#include "lastexpress/game/sound.h" #include "lastexpress/game/state.h" +#include "lastexpress/sound/sound.h" + #include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" diff --git a/engines/lastexpress/entities/alouan.cpp b/engines/lastexpress/entities/alouan.cpp index 715622aaab..cd79870559 100644 --- a/engines/lastexpress/entities/alouan.cpp +++ b/engines/lastexpress/entities/alouan.cpp @@ -26,9 +26,10 @@ #include "lastexpress/game/logic.h" #include "lastexpress/game/object.h" #include "lastexpress/game/savepoint.h" -#include "lastexpress/game/sound.h" #include "lastexpress/game/state.h" +#include "lastexpress/sound/sound.h" + #include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" diff --git a/engines/lastexpress/entities/anna.cpp b/engines/lastexpress/entities/anna.cpp index 0bedda41e8..b13aa21f6d 100644 --- a/engines/lastexpress/entities/anna.cpp +++ b/engines/lastexpress/entities/anna.cpp @@ -22,17 +22,20 @@ #include "lastexpress/entities/anna.h" +#include "lastexpress/fight/fight.h" + #include "lastexpress/game/action.h" #include "lastexpress/game/entities.h" -#include "lastexpress/game/fight.h" #include "lastexpress/game/inventory.h" #include "lastexpress/game/logic.h" #include "lastexpress/game/object.h" #include "lastexpress/game/savepoint.h" #include "lastexpress/game/scenes.h" -#include "lastexpress/game/sound.h" #include "lastexpress/game/state.h" +#include "lastexpress/sound/queue.h" +#include "lastexpress/sound/sound.h" + #include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" @@ -311,7 +314,7 @@ IMPLEMENT_FUNCTION(12, Anna, function12) params->param4 = 0; params->param5 = 0; } else { - getSound()->removeFromQueue(kEntityAnna); + getSoundQueue()->removeFromQueue(kEntityAnna); getObjects()->update(kObjectCompartmentF, kEntityAnna, kObjectLocation1, kCursorNormal, kCursorNormal); getObjects()->update(kObject53, kEntityAnna, kObjectLocation1, kCursorNormal, kCursorNormal); @@ -322,7 +325,7 @@ IMPLEMENT_FUNCTION(12, Anna, function12) break; case kActionOpenDoor: - getSound()->removeFromQueue(kEntityAnna); + getSoundQueue()->removeFromQueue(kEntityAnna); setCallback(3); setup_playSound("LIB013"); break; @@ -338,8 +341,8 @@ IMPLEMENT_FUNCTION(12, Anna, function12) getEntities()->drawSequenceLeft(kEntityAnna, "418C"); - if (getSound()->isBuffered(kEntityAnna)) - getSound()->processEntry(kEntityAnna); + if (getSoundQueue()->isBuffered(kEntityAnna)) + getSoundQueue()->processEntry(kEntityAnna); getSound()->playSound(kEntityAnna, "ANN2135A"); break; @@ -378,7 +381,7 @@ IMPLEMENT_FUNCTION(12, Anna, function12) break; case 3: - if (!getSound()->isBuffered(kEntityMax)) { + if (!getSoundQueue()->isBuffered(kEntityMax)) { setCallback(4); setup_playSound("MAX1120"); break; @@ -502,7 +505,7 @@ IMPLEMENT_FUNCTION_IS(15, Anna, function15, TimeValue) break; case 1: - if (!getSound()->isBuffered(kEntityMax)) { + if (!getSoundQueue()->isBuffered(kEntityMax)) { setCallback(2); setup_playSound("MAX1120"); break; @@ -1455,7 +1458,7 @@ label_callback_1: case 2: case 3: - if (!getSound()->isBuffered(kEntityMax)) { + if (!getSoundQueue()->isBuffered(kEntityMax)) { setCallback(4); setup_playSound("MAX1120"); break; @@ -1520,8 +1523,8 @@ IMPLEMENT_FUNCTION(35, Anna, function35) case kActionKnock: case kActionOpenDoor: - if (getSound()->isBuffered(kEntityAnna)) - getSound()->processEntry(kEntityAnna); + if (getSoundQueue()->isBuffered(kEntityAnna)) + getSoundQueue()->processEntry(kEntityAnna); if (savepoint.action == kActionKnock) getSound()->playSound(kEntityPlayer, "LIB012"); @@ -1563,8 +1566,8 @@ IMPLEMENT_FUNCTION(35, Anna, function35) break; case kAction226031488: - if (getSound()->isBuffered(kEntityAnna)) - getSound()->processEntry(kEntityAnna); + if (getSoundQueue()->isBuffered(kEntityAnna)) + getSoundQueue()->processEntry(kEntityAnna); getSavePoints()->push(kEntityAnna, kEntityMax, kAction71277948); break; @@ -1843,7 +1846,7 @@ IMPLEMENT_FUNCTION(41, Anna, function41) case 1: case 2: - if (!getSound()->isBuffered(kEntityMax)) { + if (!getSoundQueue()->isBuffered(kEntityMax)) { setCallback(3); setup_playSound("MAX1120"); break; @@ -2062,7 +2065,7 @@ IMPLEMENT_FUNCTION(47, Anna, function47) break; case 4: - getSound()->playSound(kEntityAnna, getEvent(kEventAugustLunch) ? "Ann3136" : "Ann3136A", SoundManager::kFlagInvalid, 30); + getSound()->playSound(kEntityAnna, getEvent(kEventAugustLunch) ? "Ann3136" : "Ann3136A", kFlagInvalid, 30); getSavePoints()->push(kEntityAnna, kEntityAugust, kAction122358304); setCallback(5); @@ -2089,7 +2092,7 @@ IMPLEMENT_FUNCTION(48, Anna, function48) break; if (params->param3 != kTimeInvalid && getState()->time > kTime1969200) { - UPDATE_PARAM_PROC_TIME(kTime1983600, (!getEntities()->isInRestaurant(kEntityPlayer) || getSound()->isBuffered(kEntityBoutarel)), params->param3, 150) + UPDATE_PARAM_PROC_TIME(kTime1983600, (!getEntities()->isInRestaurant(kEntityPlayer) || getSoundQueue()->isBuffered(kEntityBoutarel)), params->param3, 150) setCallback(3); setup_playSound("Aug3007A"); break; @@ -2257,7 +2260,7 @@ IMPLEMENT_FUNCTION(51, Anna, function51) break; case kActionDefault: - getSound()->playSound(kEntityAnna, "Aug3142", SoundManager::kFlagInvalid, 30); + getSound()->playSound(kEntityAnna, "Aug3142", kFlagInvalid, 30); getEntities()->updatePositionEnter(kEntityAnna, kCarRestaurant, 57); getEntities()->drawSequenceRight(kEntityAnna, "112A"); if (getEntities()->isInRestaurant(kEntityPlayer)) @@ -2480,7 +2483,7 @@ IMPLEMENT_FUNCTION(53, Anna, function53) break; case 1: - if (!getSound()->isBuffered(kEntityMax)) { + if (!getSoundQueue()->isBuffered(kEntityMax)) { setCallback(2); setup_playSound("MAX1120"); break; @@ -2619,7 +2622,7 @@ IMPLEMENT_FUNCTION(54, Anna, function54) break; case 1: - if (!getSound()->isBuffered(kEntityMax)) { + if (!getSoundQueue()->isBuffered(kEntityMax)) { setCallback(2); setup_playSound("MAX1120"); break; @@ -2788,7 +2791,7 @@ IMPLEMENT_FUNCTION(57, Anna, function57) break; case 4: - if (getSound()->isBuffered(kEntityAugust)) { + if (getSoundQueue()->isBuffered(kEntityAugust)) { setCallback(4); setup_updateFromTime(75); } else { @@ -2816,7 +2819,7 @@ IMPLEMENT_FUNCTION(57, Anna, function57) case kAction123712592: getEntities()->drawSequenceLeft(kEntityAnna, "628Af"); - if (getSound()->isBuffered(kEntityAugust)) { + if (getSoundQueue()->isBuffered(kEntityAugust)) { setCallback(4); setup_updateFromTime(75); } else { @@ -3157,8 +3160,8 @@ IMPLEMENT_FUNCTION(63, Anna, function63) // Anna will get killed... case kAction272177921: - if (getSound()->isBuffered("MUS012")) - getSound()->processEntry("MUS012"); + if (getSoundQueue()->isBuffered("MUS012")) + getSoundQueue()->processEntry("MUS012"); setCallback(1); setup_savegame(kSavegameTypeEvent, kEventAnnaKilled); @@ -3840,7 +3843,7 @@ IMPLEMENT_FUNCTION(78, Anna, function78) case 2: getAction()->playAnimation(kEventKronosHostageAnna); getScenes()->loadSceneFromPosition(kCarRestaurant, 61); - getSound()->playSound(kEntityAnna, "Mus024", SoundManager::kFlagDefault); + getSound()->playSound(kEntityAnna, "Mus024", kFlagDefault); setup_function79(); break; } @@ -3910,11 +3913,11 @@ IMPLEMENT_FUNCTION(80, Anna, function80) case kActionNone: UPDATE_PARAM(params->param1, getState()->timeTicks, 450); - getSound()->playSound(kEntityPlayer, "Kro5001", SoundManager::kFlagDefault); + getSound()->playSound(kEntityPlayer, "Kro5001", kFlagDefault); break; case kActionEndSound: - getSound()->playSound(kEntityPlayer, "Kro5002", SoundManager::kFlagDefault); + getSound()->playSound(kEntityPlayer, "Kro5002", kFlagDefault); getState()->time = kTime4923000; setCallback(1); @@ -3934,12 +3937,12 @@ IMPLEMENT_FUNCTION(80, Anna, function80) break; case 1: - if (getSound()->isBuffered(kEntityAnna)) - getSound()->processEntry(kEntityAnna); + if (getSoundQueue()->isBuffered(kEntityAnna)) + getSoundQueue()->processEntry(kEntityAnna); getAction()->playAnimation(kEventKronosBringFirebird); getScenes()->loadSceneFromItem(kItemFirebird); - getSound()->playSound(kEntityAnna, "Mus025", SoundManager::kFlagDefault); + getSound()->playSound(kEntityAnna, "Mus025", kFlagDefault); break; case 2: @@ -3950,8 +3953,8 @@ IMPLEMENT_FUNCTION(80, Anna, function80) case 3: getProgress().isEggOpen = true; - if (getSound()->isBuffered(kEntityAnna)) - getSound()->processEntry(kEntityAnna); + if (getSoundQueue()->isBuffered(kEntityAnna)) + getSoundQueue()->processEntry(kEntityAnna); getAction()->playAnimation(kEventKronosOpenFirebird); getScenes()->loadSceneFromPosition(kCarRestaurant, 3); diff --git a/engines/lastexpress/entities/august.cpp b/engines/lastexpress/entities/august.cpp index f7e7390b90..eb3b09af59 100644 --- a/engines/lastexpress/entities/august.cpp +++ b/engines/lastexpress/entities/august.cpp @@ -33,9 +33,11 @@ #include "lastexpress/game/object.h" #include "lastexpress/game/savepoint.h" #include "lastexpress/game/scenes.h" -#include "lastexpress/game/sound.h" #include "lastexpress/game/state.h" +#include "lastexpress/sound/queue.h" +#include "lastexpress/sound/sound.h" + #include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" @@ -199,7 +201,7 @@ IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// IMPLEMENT_FUNCTION_S(13, August, playSound16) - Entity::playSound(savepoint, false, SoundManager::kFlagDefault); + Entity::playSound(savepoint, false, kFlagDefault); IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// @@ -338,7 +340,7 @@ IMPLEMENT_FUNCTION_II(19, August, function19, bool, bool) case kAction1: getData()->inventoryItem = kItemNone; getSound()->playSound(kEntityPlayer, "CAT1002"); - getSound()->playSound(kEntityAugust, "AUG3101", SoundManager::kFlagInvalid, 15); + getSound()->playSound(kEntityAugust, "AUG3101", kFlagInvalid, 15); break; case kActionDefault: @@ -1427,7 +1429,7 @@ IMPLEMENT_FUNCTION(29, August, function29) if (getState()->time < kTime1134000) { if (!getEntities()->isInRestaurant(kEntityPlayer) - || getSound()->isBuffered("MRB1076") || getSound()->isBuffered("MRB1078") || getSound()->isBuffered("MRB1078A")) + || getSoundQueue()->isBuffered("MRB1076") || getSoundQueue()->isBuffered("MRB1078") || getSoundQueue()->isBuffered("MRB1078A")) params->param3 = (uint)getState()->time + 225; if (params->param3 > getState()->time) @@ -1762,7 +1764,7 @@ IMPLEMENT_FUNCTION(34, August, function34) break; case kActionNone: - if (!getSound()->isBuffered(kEntityAugust) && getProgress().field_18 != 4) + if (!getSoundQueue()->isBuffered(kEntityAugust) && getProgress().field_18 != 4) getSound()->playSound(kEntityAugust, "AUG1057"); // August snoring break; @@ -2179,11 +2181,11 @@ IMPLEMENT_FUNCTION_III(42, August, function42, CarIndex, EntityPosition, bool) getData()->inventoryItem = kItemNone; getSound()->playSound(kEntityPlayer, "CAT1002"); - getSound()->playSound(kEntityAugust, getEvent(kEventAugustBringBriefcase) ? "AUG3103" : "AUG3100", SoundManager::kFlagInvalid, 15); + getSound()->playSound(kEntityAugust, getEvent(kEventAugustBringBriefcase) ? "AUG3103" : "AUG3100", kFlagInvalid, 15); break; case kActionExcuseMe: - if (!getSound()->isBuffered(kEntityAugust)) + if (!getSoundQueue()->isBuffered(kEntityAugust)) getSound()->excuseMe(kEntityAugust); break; @@ -2385,7 +2387,7 @@ IMPLEMENT_FUNCTION(45, August, function45) case kAction1: getData()->inventoryItem = kItemNone; getSound()->playSound(kEntityPlayer, "CAT1002"); - getSound()->playSound(kEntityAugust, "AUG3102", SoundManager::kFlagInvalid, 15); + getSound()->playSound(kEntityAugust, "AUG3102", kFlagInvalid, 15); break; case kActionDefault: @@ -3343,7 +3345,7 @@ IMPLEMENT_FUNCTION(65, August, function65) getObjects()->update(kObjectCompartment3, kEntityPlayer, kObjectLocation1, kCursorHandKnock, kCursorHand); - if (!getSound()->isBuffered(kEntityAugust)) + if (!getSoundQueue()->isBuffered(kEntityAugust)) getSound()->playSound(kEntityAugust, "AUG1057"); // August snoring break; } @@ -3504,9 +3506,9 @@ IMPLEMENT_FUNCTION(69, August, unhookCars) break; case kActionDefault: - getSound()->processEntries(); - if (getSound()->isBuffered("ARRIVE")) - getSound()->removeFromQueue("ARRIVE"); + getSoundQueue()->processEntries(); + if (getSoundQueue()->isBuffered("ARRIVE")) + getSoundQueue()->removeFromQueue("ARRIVE"); setCallback(1); setup_savegame(kSavegameTypeEvent, kEventAugustUnhookCarsBetrayal); @@ -3516,7 +3518,7 @@ IMPLEMENT_FUNCTION(69, August, unhookCars) if (getCallback() == 1) { getAction()->playAnimation(getProgress().field_C ? kEventAugustUnhookCarsBetrayal : kEventAugustUnhookCars); getEntities()->clearSequences(kEntityAugust); - getSound()->resetState(); + getSoundQueue()->resetState(); getSound()->playSound(kEntityPlayer, "MUS050"); getScenes()->loadSceneFromPosition(kCarRestaurant, 85, 1); getSavePoints()->pushAll(kEntityAugust, kActionProceedChapter5); diff --git a/engines/lastexpress/entities/boutarel.cpp b/engines/lastexpress/entities/boutarel.cpp index 0b2040897c..315b12a69e 100644 --- a/engines/lastexpress/entities/boutarel.cpp +++ b/engines/lastexpress/entities/boutarel.cpp @@ -29,9 +29,11 @@ #include "lastexpress/game/object.h" #include "lastexpress/game/scenes.h" #include "lastexpress/game/savepoint.h" -#include "lastexpress/game/sound.h" #include "lastexpress/game/state.h" +#include "lastexpress/sound/queue.h" +#include "lastexpress/sound/sound.h" + #include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" @@ -214,7 +216,7 @@ IMPLEMENT_FUNCTION_I(11, Boutarel, function11, bool) break; case kChapter1: - getSound()->playSound(kEntityBoutarel, "MRB1075", SoundManager::kFlagInvalid, 60); + getSound()->playSound(kEntityBoutarel, "MRB1075", kFlagInvalid, 60); break; case kChapter3: @@ -941,7 +943,7 @@ IMPLEMENT_FUNCTION(29, Boutarel, function29) if (getEntities()->isInRestaurant(kEntityAnna) && getEntities()->isInRestaurant(kEntityAugust) - && !getSound()->isBuffered(kEntityBoutarel) + && !getSoundQueue()->isBuffered(kEntityBoutarel) && params->param3 != kTimeInvalid) { if (getState()->time <= kTime1998000) diff --git a/engines/lastexpress/entities/chapters.cpp b/engines/lastexpress/entities/chapters.cpp index 1252a62d8d..96e08ba808 100644 --- a/engines/lastexpress/entities/chapters.cpp +++ b/engines/lastexpress/entities/chapters.cpp @@ -57,13 +57,16 @@ #include "lastexpress/game/entities.h" #include "lastexpress/game/inventory.h" #include "lastexpress/game/logic.h" -#include "lastexpress/game/menu.h" #include "lastexpress/game/object.h" #include "lastexpress/game/savepoint.h" #include "lastexpress/game/scenes.h" -#include "lastexpress/game/sound.h" #include "lastexpress/game/state.h" +#include "lastexpress/menu/menu.h" +#include "lastexpress/sound/sound.h" + +#include "lastexpress/sound/queue.h" + #include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" #include "lastexpress/resource.h" @@ -159,20 +162,20 @@ IMPLEMENT_FUNCTION(6, Chapters, chapter1End) break; case kActionEndSound: - getSound()->playSound(kEntityChapters, "MUS0009", SoundManager::kFlagDefault); + getSound()->playSound(kEntityChapters, "MUS0009", kFlagDefault); break; case kActionKnock: - if (!getSound()->isBuffered("LIB012", true)) + if (!getSoundQueue()->isBuffered("LIB012", true)) getSound()->playSound(kEntityPlayer, "LIB012"); break; case kActionOpenDoor: if (params->param1) { getEntities()->clearSequences(kEntityChapters); - getSound()->processEntry(kEntityChapters); + getSoundQueue()->processEntry(kEntityChapters); getSound()->playSound(kEntityPlayer, "LIB014"); - getSound()->resetState(); + getSoundQueue()->resetState(); ENTITY_PARAM(0, 4) = 7; @@ -191,10 +194,10 @@ IMPLEMENT_FUNCTION(6, Chapters, chapter1End) CALLBACK_ACTION(); } else { getSound()->playSound(kEntityPlayer, "LIB014"); - getSound()->playSound(kEntityPlayer, "LIB015", SoundManager::kFlagDefault, 15); + getSound()->playSound(kEntityPlayer, "LIB015", kFlagDefault, 15); - if (!getSound()->isBuffered(kEntityChapters)) - getSound()->playSound(kEntityChapters, "MUS009", SoundManager::kFlagDefault); + if (!getSoundQueue()->isBuffered(kEntityChapters)) + getSound()->playSound(kEntityChapters, "MUS009", kFlagDefault); getScenes()->loadSceneFromPosition(kCarLocomotive, 38); @@ -240,42 +243,42 @@ IMPLEMENT_FUNCTION(6, Chapters, chapter1End) RESET_ENTITY_STATE(kEntityHadija, Alouan, setup_function12); if (ENTITY_PARAM(0, 2) || ENTITY_PARAM(0, 3)) { - getSound()->removeFromQueue(kEntityChapters); + getSoundQueue()->removeFromQueue(kEntityChapters); ENTITY_PARAM(0, 2) = 0; ENTITY_PARAM(0, 3) = 0; } - getSound()->processEntries(); + getSoundQueue()->processEntries(); - if (getSound()->isBuffered("CON1505")) - getSound()->processEntry("CON1505"); + if (getSoundQueue()->isBuffered("CON1505")) + getSoundQueue()->processEntry("CON1505"); - if (getSound()->isBuffered("AUG1057")) - getSound()->processEntry("AUG1057"); + if (getSoundQueue()->isBuffered("AUG1057")) + getSoundQueue()->processEntry("AUG1057"); - if (getSound()->isBuffered("ZFX1005")) - getSound()->processEntry("ZFX1005"); + if (getSoundQueue()->isBuffered("ZFX1005")) + getSoundQueue()->processEntry("ZFX1005"); - if (getSound()->isBuffered("ZFX1006")) - getSound()->processEntry("ZFX1006"); + if (getSoundQueue()->isBuffered("ZFX1006")) + getSoundQueue()->processEntry("ZFX1006"); - if (getSound()->isBuffered("ZFX1007")) - getSound()->processEntry("ZFX1007"); + if (getSoundQueue()->isBuffered("ZFX1007")) + getSoundQueue()->processEntry("ZFX1007"); - if (getSound()->isBuffered("ZFX1007A")) - getSound()->processEntry("ZFX1007A"); + if (getSoundQueue()->isBuffered("ZFX1007A")) + getSoundQueue()->processEntry("ZFX1007A"); - if (getSound()->isBuffered("ZFX1007B")) - getSound()->processEntry("ZFX1007B"); + if (getSoundQueue()->isBuffered("ZFX1007B")) + getSoundQueue()->processEntry("ZFX1007B"); - getSound()->playSound(kEntityPlayer, "MUS008", SoundManager::kFlagDefault); + getSound()->playSound(kEntityPlayer, "MUS008", kFlagDefault); getInventory()->unselectItem(); // FIXME add event pump ? - while (getSound()->isBuffered("MUS008")) - getSound()->updateQueue(); + while (getSoundQueue()->isBuffered("MUS008")) + getSoundQueue()->updateQueue(); getProgress().field_84 = true; @@ -300,7 +303,7 @@ IMPLEMENT_FUNCTION(6, Chapters, chapter1End) if (params->param2 >= 3) { - if (!getSound()->isBuffered("LIB031", true)) + if (!getSoundQueue()->isBuffered("LIB031", true)) getSound()->playSound(kEntityPlayer, "LIB031"); if (params->param2 == 3) { @@ -318,7 +321,7 @@ IMPLEMENT_FUNCTION(7, Chapters, chapter1Init) return; getProgress().chapter = kChapter1; - getSound()->resetState(); + getSoundQueue()->resetState(); getState()->time = kTimeChapter1; getState()->timeDelta = 0; @@ -384,7 +387,7 @@ IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// #define PLAY_STEAM() { \ - getSound()->resetState(); \ + getSoundQueue()->resetState(); \ getSound()->playSteam((CityIndex)ENTITY_PARAM(0, 4)); \ ENTITY_PARAM(0, 2) = 0; \ } @@ -562,7 +565,7 @@ label_chapter1_next: } if (ENTITY_PARAM(0, 3)) { - getSound()->resetState(); + getSoundQueue()->resetState(); ENTITY_PARAM(0, 3) = 0; if (params->param4) { @@ -693,16 +696,16 @@ IMPLEMENT_FUNCTION(9, Chapters, chapter1Next) if (savepoint.action == kActionDefault) { // Reset sound cache if (ENTITY_PARAM(0, 2) || ENTITY_PARAM(0, 3)) { - getSound()->removeFromQueue(kEntityChapters); + getSoundQueue()->removeFromQueue(kEntityChapters); ENTITY_PARAM(0, 2) = 0; ENTITY_PARAM(0, 3) = 0; } - getSound()->playSound(kEntityPlayer, "MUS008", SoundManager::kFlagDefault); + getSound()->playSound(kEntityPlayer, "MUS008", kFlagDefault); getInventory()->unselectItem(); - while (getSound()->isBuffered("MUS008")) - getSound()->updateQueue(); + while (getSoundQueue()->isBuffered("MUS008")) + getSoundQueue()->updateQueue(); setup_chapter2(); } @@ -789,7 +792,7 @@ IMPLEMENT_FUNCTION(11, Chapters, chapter2Init) // Reset sound cache if (ENTITY_PARAM(0, 2) || ENTITY_PARAM(0, 3)) { - getSound()->removeFromQueue(kEntityChapters); + getSoundQueue()->removeFromQueue(kEntityChapters); ENTITY_PARAM(0, 2) = 0; ENTITY_PARAM(0, 3) = 0; } @@ -873,7 +876,7 @@ IMPLEMENT_FUNCTION(14, Chapters, chapter3Init) getObjects()->update(kObject107, kEntityPlayer, kObjectLocation3, kCursorKeepValue, kCursorKeepValue); if (ENTITY_PARAM(0, 2) || ENTITY_PARAM(0, 3)) { - getSound()->removeFromQueue(kEntityChapters); + getSoundQueue()->removeFromQueue(kEntityChapters); ENTITY_PARAM(0, 2) = 0; ENTITY_PARAM(0, 3) = 0; } @@ -914,11 +917,11 @@ IMPLEMENT_FUNCTION(15, Chapters, chapter3Handler) break; case 0: - getSound()->playSound(kEntityPlayer, "ZFX1008", (SoundManager::FlagType)(rnd(15) + 2)); + getSound()->playSound(kEntityPlayer, "ZFX1008", (SoundFlag)(rnd(15) + 2)); break; case 1: - getSound()->playSound(kEntityPlayer, "ZFX1009", (SoundManager::FlagType)(rnd(15) + 2)); + getSound()->playSound(kEntityPlayer, "ZFX1009", (SoundFlag)(rnd(15) + 2)); break; } @@ -986,7 +989,7 @@ label_callback_8: } } - getSound()->resetState(); + getSoundQueue()->resetState(); getSound()->playSteam((CityIndex)ENTITY_PARAM(0, 4)); ENTITY_PARAM(0, 2) = 0; @@ -997,7 +1000,7 @@ label_callback_8: } if (ENTITY_PARAM(0, 3)) { - getSound()->resetState(); + getSoundQueue()->resetState(); ENTITY_PARAM(0, 3) = 0; } break; @@ -1149,8 +1152,8 @@ IMPLEMENT_FUNCTION(18, Chapters, chapter4Init) if (savepoint.action != kActionDefault) return; - getSound()->processEntries(); - getSound()->resetState(); + getSoundQueue()->processEntries(); + getSoundQueue()->resetState(); getProgress().isTrainRunning = true; @@ -1176,7 +1179,7 @@ IMPLEMENT_FUNCTION(18, Chapters, chapter4Init) getObjects()->update(kObject107, kEntityPlayer, kObjectLocation3, kCursorKeepValue, kCursorKeepValue); if (ENTITY_PARAM(0, 2) || ENTITY_PARAM(0, 3)) { - getSound()->removeFromQueue(kEntityChapters); + getSoundQueue()->removeFromQueue(kEntityChapters); ENTITY_PARAM(0, 2) = 0; ENTITY_PARAM(0, 3) = 0; } @@ -1213,11 +1216,11 @@ IMPLEMENT_FUNCTION(19, Chapters, chapter4Handler) break; case 0: - getSound()->playSound(kEntityPlayer, "ZFX1008", (SoundManager::FlagType)(rnd(15) + 2)); + getSound()->playSound(kEntityPlayer, "ZFX1008", (SoundFlag)(rnd(15) + 2)); break; case 1: - getSound()->playSound(kEntityPlayer, "ZFX1009", (SoundManager::FlagType)(rnd(15) + 2)); + getSound()->playSound(kEntityPlayer, "ZFX1009", (SoundFlag)(rnd(15) + 2)); break; } @@ -1318,7 +1321,7 @@ label_callback_4: } if (ENTITY_PARAM(0, 3)) { - getSound()->resetState(); + getSoundQueue()->resetState(); ENTITY_PARAM(0, 3) = 0; } else if (!params->param2 && !params->param3) { getSound()->playSound(kEntityChapters, "ZFX1001"); @@ -1355,17 +1358,17 @@ label_callback_4: goto label_callback_4; case 5: - if (getSound()->isBuffered(kEntityChapters)) - getSound()->removeFromQueue(kEntityChapters); + if (getSoundQueue()->isBuffered(kEntityChapters)) + getSoundQueue()->removeFromQueue(kEntityChapters); getAction()->playAnimation(kEventTrainExplosionBridge); getLogic()->gameOver(kSavegameTypeIndex, 1, kSceneNone, true); break; case 6: - getSound()->processEntries(); + getSoundQueue()->processEntries(); getAction()->playAnimation(kEventTylerCastleDream); - getSound()->resetState(); + getSoundQueue()->resetState(); getProgress().field_18 = 1; @@ -1417,7 +1420,7 @@ label_callback_4: case 11: getScenes()->loadSceneFromPosition(kCarRedSleeping, 74); - getSound()->playSound(kEntityTrain, "ZFX4001", SoundManager::kFlagDefault); + getSound()->playSound(kEntityTrain, "ZFX4001", kFlagDefault); getLogic()->gameOver(kSavegameTypeIndex, 1, kSceneNone, true); break; } @@ -1464,17 +1467,17 @@ label_callback_4: params->param1 = 1; if (ENTITY_PARAM(0, 2) || ENTITY_PARAM(0, 3)) { - getSound()->removeFromQueue(kEntityChapters); + getSoundQueue()->removeFromQueue(kEntityChapters); ENTITY_PARAM(0, 2) = 0; ENTITY_PARAM(0, 3) = 0; } - getSound()->playSound(kEntityPlayer, "MUS008", SoundManager::kFlagDefault); + getSound()->playSound(kEntityPlayer, "MUS008", kFlagDefault); getInventory()->unselectItem(); - while (getSound()->isBuffered("MUS008")) - getSound()->updateQueue(); + while (getSoundQueue()->isBuffered("MUS008")) + getSoundQueue()->updateQueue(); if (getInventory()->hasItem(kItemBomb)) { RESET_ENTITY_STATE(kEntityAlexei, Alexei, setup_function47); @@ -1521,8 +1524,8 @@ label_callback_4: case kAction191001984: getState()->time = kTime2520000; - if (getSound()->isBuffered(kEntityChapters)) - getSound()->removeFromQueue(kEntityChapters); + if (getSoundQueue()->isBuffered(kEntityChapters)) + getSoundQueue()->removeFromQueue(kEntityChapters); getEntities()->clearSequences(kEntityChapters); getInventory()->removeItem(kItemTelegram); @@ -1534,10 +1537,10 @@ label_callback_4: break; case kAction201959744: - if (getSound()->isBuffered(kEntityChapters)) - getSound()->removeFromQueue(kEntityChapters); + if (getSoundQueue()->isBuffered(kEntityChapters)) + getSoundQueue()->removeFromQueue(kEntityChapters); - getSound()->playSound(kEntityTrain, "ZFX4001", SoundManager::kFlagDefault); + getSound()->playSound(kEntityTrain, "ZFX4001", kFlagDefault); getLogic()->gameOver(kSavegameTypeIndex, 0, kSceneNone, true); break; @@ -1643,7 +1646,7 @@ IMPLEMENT_FUNCTION(21, Chapters, chapter5Init) getObjects()->updateLocation2(kObjectRestaurantCar, kObjectLocation2); if (ENTITY_PARAM(0, 2) || ENTITY_PARAM(0, 3)) { - getSound()->removeFromQueue(kEntityChapters); + getSoundQueue()->removeFromQueue(kEntityChapters); ENTITY_PARAM(0, 2) = 0; ENTITY_PARAM(0, 3) = 0; } @@ -1673,8 +1676,8 @@ IMPLEMENT_FUNCTION(22, Chapters, chapter5Handler) params->param2 = 1; if (!getProgress().isNightTime) { - getSound()->playSound(kEntityChapters, "ARRIVE", SoundManager::kFlag8); - getSound()->processEntries(); + getSound()->playSound(kEntityChapters, "ARRIVE", kFlag8); + getSoundQueue()->processEntries(); } } @@ -1682,8 +1685,8 @@ IMPLEMENT_FUNCTION(22, Chapters, chapter5Handler) params->param3 = 1; if (!getEvent(kEventLocomotiveMilosDay) && !getEvent(kEventLocomotiveMilosNight)) { - getSound()->playSound(kEntityChapters, "ARRIVE", SoundManager::kFlag8); - getSound()->processEntries(); + getSound()->playSound(kEntityChapters, "ARRIVE", kFlag8); + getSoundQueue()->processEntries(); } } break; @@ -1712,8 +1715,8 @@ IMPLEMENT_FUNCTION(22, Chapters, chapter5Handler) getProgress().isNightTime = true; getState()->time = kTime2916000; - if (getSound()->isBuffered(kEntityChapters)) - getSound()->removeFromQueue(kEntityChapters); + if (getSoundQueue()->isBuffered(kEntityChapters)) + getSoundQueue()->removeFromQueue(kEntityChapters); break; } IMPLEMENT_FUNCTION_END @@ -1729,7 +1732,7 @@ void Chapters::enterExitStation(const SavePoint &savepoint, bool isEnteringStati return; } - getSound()->removeFromQueue(kEntityChapters); + getSoundQueue()->removeFromQueue(kEntityChapters); if (!ENTITY_PARAM(0, 2)) { if (ENTITY_PARAM(0, 3)) @@ -1796,8 +1799,8 @@ void Chapters::enterExitStation(const SavePoint &savepoint, bool isEnteringStati void Chapters::enterExitHelper(bool isEnteringStation) { EXPOSE_PARAMS(EntityData::EntityParametersSIIS); - getSound()->playSound(kEntityChapters, isEnteringStation ? "ARRIVE" : "DEPART", SoundManager::kFlag8); - getSound()->processEntries(); + getSound()->playSound(kEntityChapters, isEnteringStation ? "ARRIVE" : "DEPART", kFlag8); + getSoundQueue()->processEntries(); getObjects()->update(kObjectHandleOutsideLeft, kEntityPlayer, kObjectLocation1, kCursorNormal, isEnteringStation ? kCursorNormal : kCursorHand); getObjects()->update(kObjectHandleOutsideRight, kEntityPlayer, kObjectLocation1, kCursorNormal, isEnteringStation ? kCursorNormal : kCursorHand); diff --git a/engines/lastexpress/entities/cooks.cpp b/engines/lastexpress/entities/cooks.cpp index 336f911800..42e888cc7c 100644 --- a/engines/lastexpress/entities/cooks.cpp +++ b/engines/lastexpress/entities/cooks.cpp @@ -26,9 +26,11 @@ #include "lastexpress/game/logic.h" #include "lastexpress/game/object.h" #include "lastexpress/game/savepoint.h" -#include "lastexpress/game/sound.h" #include "lastexpress/game/state.h" +#include "lastexpress/sound/queue.h" +#include "lastexpress/sound/sound.h" + #include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" @@ -101,7 +103,7 @@ IMPLEMENT_FUNCTION(3, Cooks, function3) if (getEntities()->isPlayerPosition(kCarRestaurant, 46)) { getEntities()->drawSequenceLeft(kEntityCooks, "308D"); - if (!getSound()->isBuffered(kEntityCooks)) { + if (!getSoundQueue()->isBuffered(kEntityCooks)) { if (params->param1) { if (!getEntities()->hasValidFrame(kEntityCooks)) { getSound()->playSound(kEntityCooks, "LIB015"); @@ -187,7 +189,7 @@ IMPLEMENT_FUNCTION(4, Cooks, function4) if (getEntities()->isPlayerPosition(kCarRestaurant, 80)) { getEntities()->drawSequenceLeft(kEntityCooks, "308D"); - if (!getSound()->isBuffered(kEntityCooks)) { + if (!getSoundQueue()->isBuffered(kEntityCooks)) { if (params->param1) { if (!getEntities()->hasValidFrame(kEntityCooks)) { getSound()->playSound(kEntityCooks, "LIB015"); diff --git a/engines/lastexpress/entities/coudert.cpp b/engines/lastexpress/entities/coudert.cpp index e74471ebca..c3e7e37b88 100644 --- a/engines/lastexpress/entities/coudert.cpp +++ b/engines/lastexpress/entities/coudert.cpp @@ -29,9 +29,11 @@ #include "lastexpress/game/object.h" #include "lastexpress/game/savepoint.h" #include "lastexpress/game/scenes.h" -#include "lastexpress/game/sound.h" #include "lastexpress/game/state.h" +#include "lastexpress/sound/queue.h" +#include "lastexpress/sound/sound.h" + #include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" @@ -258,7 +260,7 @@ IMPLEMENT_FUNCTION_NOSETUP(7, Coudert, playSound16) break; case kActionDefault: - getSound()->playSound(kEntityCoudert, (char *)¶ms->seq1, SoundManager::kFlagDefault); + getSound()->playSound(kEntityCoudert, (char *)¶ms->seq1, kFlagDefault); break; case kActionCallback: @@ -314,7 +316,7 @@ IMPLEMENT_FUNCTION_II(9, Coudert, updateEntity, CarIndex, EntityPosition) case kActionExcuseMeCath: if (getData()->clothes == kClothes1) getSound()->playSound(kEntityPlayer, "ZFX1003", getSound()->getSoundFlag(kEntityCoudert)); - else if (!getSound()->isBuffered(kEntityCoudert)) + else if (!getSoundQueue()->isBuffered(kEntityCoudert)) getSound()->playSound(kEntityPlayer, "JAC1112", getSound()->getSoundFlag(kEntityCoudert)); break; @@ -409,7 +411,7 @@ IMPLEMENT_FUNCTION_I(12, Coudert, excuseMe, EntityIndex) if (savepoint.action != kActionDefault) return; - if (getSound()->isBuffered(kEntityCoudert)) { + if (getSoundQueue()->isBuffered(kEntityCoudert)) { CALLBACK_ACTION(); return; } @@ -823,7 +825,7 @@ IMPLEMENT_FUNCTION(18, Coudert, function18) getScenes()->loadSceneFromItemPosition(kItem5); if (getEntities()->isPlayerPosition(kCarRedSleeping, 68)) { - if (!getSound()->isBuffered(kEntityCoudert)) + if (!getSoundQueue()->isBuffered(kEntityCoudert)) getSound()->playSound(kEntityCoudert, "JAC1111"); getScenes()->loadSceneFromPosition(kCarRedSleeping, 25); @@ -1642,7 +1644,7 @@ IMPLEMENT_FUNCTION_I(31, Coudert, function31, uint32) break; case 1: - if (getSound()->isBuffered(kEntityCoudert)) { + if (getSoundQueue()->isBuffered(kEntityCoudert)) { getEntities()->drawSequenceLeft(kEntityCoudert, "627K"); } else { setCallback(2); @@ -1929,7 +1931,7 @@ IMPLEMENT_FUNCTION_I(35, Coudert, function35, bool) break; case 1: - if (!getSound()->isBuffered(kEntityCoudert)) + if (!getSoundQueue()->isBuffered(kEntityCoudert)) getSound()->playSound(kEntityCoudert, "Ann3124"); if (params->param1) @@ -2008,8 +2010,8 @@ IMPLEMENT_FUNCTION(37, Coudert, function37) break; case kActionDefault: - if (getSound()->isBuffered(kEntityCoudert)) - getSound()->processEntry(kEntityCoudert); + if (getSoundQueue()->isBuffered(kEntityCoudert)) + getSoundQueue()->processEntry(kEntityCoudert); if (ENTITY_PARAM(0, 7)) { getData()->entityPosition = kPosition_8200; @@ -2268,7 +2270,7 @@ label_callback_8: } label_callback_9: - if (ENTITY_PARAM(0, 1) && !getSound()->isBuffered(kEntityCoudert)) + if (ENTITY_PARAM(0, 1) && !getSoundQueue()->isBuffered(kEntityCoudert)) getSound()->playSound(kEntityCoudert, rnd(2) ? "JAC1065" : "JAC1065A"); if (getState()->time > kTime1107000 && !ENTITY_PARAM(0, 1) && !getEvent(kEventVassiliSeizure)) { @@ -3019,7 +3021,7 @@ IMPLEMENT_FUNCTION(46, Coudert, function46) // Fallback to next case case 7: - if (getSound()->isBuffered(kEntityCoudert)) { + if (getSoundQueue()->isBuffered(kEntityCoudert)) { setCallback(7); setup_updateFromTime(75); } else { @@ -3088,7 +3090,7 @@ IMPLEMENT_FUNCTION_I(47, Coudert, function47, bool) // Fallback to next case case 4: - if (getSound()->isBuffered(kEntityCoudert)) { + if (getSoundQueue()->isBuffered(kEntityCoudert)) { setCallback(4); setup_updateFromTime(225); } else { diff --git a/engines/lastexpress/entities/entity.cpp b/engines/lastexpress/entities/entity.cpp index 22750989fb..e136ca4776 100644 --- a/engines/lastexpress/entities/entity.cpp +++ b/engines/lastexpress/entities/entity.cpp @@ -33,9 +33,10 @@ #include "lastexpress/game/state.h" #include "lastexpress/game/savegame.h" #include "lastexpress/game/savepoint.h" -#include "lastexpress/game/sound.h" #include "lastexpress/game/state.h" +#include "lastexpress/sound/sound.h" + #include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" @@ -104,24 +105,24 @@ void EntityData::EntityCallData::saveLoadWithSerializer(Common::Serializer &s) { ////////////////////////////////////////////////////////////////////////// EntityData::EntityParameters *EntityData::getParameters(uint callback, byte index) const { if (callback >= 9) - error("EntityData::getParameters: invalid callback value (was: %d, max: 9)", callback); + error("[EntityData::getParameters] Invalid callback value (was: %d, max: 9)", callback); if (index >= 4) - error("EntityData::getParameters: invalid index value (was: %d, max: 4)", index); + error("[EntityData::getParameters] Invalid index value (was: %d, max: 4)", index); return _parameters[callback].parameters[index]; } int EntityData::getCallback(uint callback) const { if (callback >= 16) - error("EntityData::getParameters: invalid callback value (was: %d, max: 16)", callback); + error("[EntityData::getCallback] Invalid callback value (was: %d, max: 16)", callback); return _data.callbacks[callback]; } void EntityData::setCallback(uint callback, byte index) { if (callback >= 16) - error("EntityData::getParameters: invalid callback value (was: %d, max: 16)", callback); + error("[EntityData::setCallback] Invalid callback value (was: %d, max: 16)", callback); _data.callbacks[callback] = index; } @@ -136,7 +137,7 @@ void EntityData::updateParameters(uint32 index) const { else if (index < 32) getParameters(8, 3)->update(index - 24); else - error("EntityData::updateParameters: invalid param index to update (was:%d, max:32)!", index); + error("[EntityData::updateParameters] Invalid param index to update (was:%d, max:32)", index); } void EntityData::saveLoadWithSerializer(Common::Serializer &s) { @@ -255,7 +256,7 @@ void Entity::savegame(const SavePoint &savepoint) { } } -void Entity::playSound(const SavePoint &savepoint, bool resetItem, SoundManager::FlagType flag) { +void Entity::playSound(const SavePoint &savepoint, bool resetItem, SoundFlag flag) { EXPOSE_PARAMS(EntityData::EntityParametersSIIS) switch (savepoint.action) { diff --git a/engines/lastexpress/entities/entity.h b/engines/lastexpress/entities/entity.h index 01cf17f791..039f461c7b 100644 --- a/engines/lastexpress/entities/entity.h +++ b/engines/lastexpress/entities/entity.h @@ -25,7 +25,7 @@ #include "lastexpress/shared.h" -#include "lastexpress/game/sound.h" +#include "lastexpress/sound/sound.h" #include "lastexpress/helpers.h" @@ -85,7 +85,7 @@ public: void update(uint32 index) { switch (index) { default: - error("EntityParametersIIII::update: invalid index (was: %d)", index); + error("[EntityParametersIIII::update] Invalid index (was: %d)", index); case 0: param1 = 1; break; case 1: param2 = 1; break; @@ -134,7 +134,7 @@ public: void update(uint32 index) { switch (index) { default: - error("EntityParametersSIII::update: invalid index (was: %d)", index); + error("[EntityParametersSIII::update] Invalid index (was: %d)", index); case 3: param4 = 1; break; case 4: param5 = 1; break; @@ -174,7 +174,7 @@ public: void update(uint32 index) { switch (index) { default: - error("EntityParametersSIIS::update: invalid index (was: %d)", index); + error("[EntityParametersSIIS::update] Invalid index (was: %d)", index); case 3: param4 = 1; break; case 4: param5 = 1; break; @@ -209,7 +209,7 @@ public: void update(uint32 index) { switch (index) { default: - error("EntityParametersISSI::update: invalid index (was: %d)", index); + error("[EntityParametersISSI::update] Invalid index (was: %d)", index); case 0: param1 = 1; break; case 7: param8 = 1; break; @@ -248,7 +248,7 @@ public: void update(uint32 index) { switch (index) { default: - error("EntityParametersISII::update: invalid index (was: %d)", index); + error("[EntityParametersISII::update] Invalid index (was: %d)", index); case 0: param1 = 1; break; case 4: param5 = 1; break; @@ -288,7 +288,7 @@ public: void update(uint32 index) { switch (index) { default: - error("EntityParametersSSII::update: invalid index (was: %d)", index); + error("[EntityParametersSSII::update] Invalid index (was: %d)", index); case 6: param7 = 1; break; case 7: param8 = 1; break; @@ -319,7 +319,7 @@ public: } void update(uint32) { - error("EntityParametersSSS::update: cannot update this type of parameters"); + error("[EntityParametersSSS::update] Cannot update this type of parameters"); } void saveLoadWithSerializer(Common::Serializer &s) { @@ -349,7 +349,7 @@ public: void update(uint32 index) { switch (index) { default: - error("EntityParametersIISS::update: invalid index (was: %d)", index); + error("[EntityParametersIISS::update] Invalid index (was: %d)", index); case 0: param1 = 1; break; case 1: param2 = 1; break; @@ -388,7 +388,7 @@ public: void update(uint32 index) { switch (index) { default: - error("EntityParametersIISI::update: invalid index (was: %d)", index); + error("[EntityParametersIISI::update] Invalid index (was: %d)", index); case 0: param1 = 1; break; case 1: param2 = 1; break; @@ -432,7 +432,7 @@ public: void update(uint32 index) { switch (index) { default: - error("EntityParametersIIIS::update: invalid index (was: %d)", index); + error("[EntityParametersIIIS::update] Invalid index (was: %d)", index); case 0: param1 = 1; break; case 1: param2 = 1; break; @@ -686,7 +686,7 @@ protected: * @param resetItem true to reset item. * @param flag sound flag */ - void playSound(const SavePoint &savepoint, bool resetItem = false, SoundManager::FlagType flag = SoundManager::kFlagInvalid); + void playSound(const SavePoint &savepoint, bool resetItem = false, SoundFlag flag = kFlagInvalid); /** * Draws the entity diff --git a/engines/lastexpress/entities/entity_intern.h b/engines/lastexpress/entities/entity_intern.h index 43d7f702c9..bf75e022de 100644 --- a/engines/lastexpress/entities/entity_intern.h +++ b/engines/lastexpress/entities/entity_intern.h @@ -96,7 +96,7 @@ void class::setup_##name() { \ #define EXPOSE_PARAMS(type) \ type *params = (type*)_data->getCurrentParameters(); \ if (!params) \ - error("Trying to call an entity function with invalid parameters!"); \ + error("[EXPOSE_PARAMS] Trying to call an entity function with invalid parameters"); \ // function signature without setup (we keep the index for consistency but never use it) @@ -413,7 +413,7 @@ void class::setup_##name() { \ ////////////////////////////////////////////////////////////////////////// #define CALLBACK_ACTION() { \ if (getData()->currentCall == 0) \ - error("CALLBACK_ACTION: currentCall is already 0, cannot proceed!"); \ + error("[CALLBACK_ACTION] currentCall is already 0, cannot proceed"); \ getData()->currentCall--; \ getSavePoints()->setCallback(_entityIndex, _callbacks[_data->getCurrentCallback()]); \ getSavePoints()->call(_entityIndex, _entityIndex, kActionCallback); \ diff --git a/engines/lastexpress/entities/francois.cpp b/engines/lastexpress/entities/francois.cpp index 86b6820499..6bbe740730 100644 --- a/engines/lastexpress/entities/francois.cpp +++ b/engines/lastexpress/entities/francois.cpp @@ -30,6 +30,8 @@ #include "lastexpress/game/savepoint.h" #include "lastexpress/game/state.h" +#include "lastexpress/sound/queue.h" + #include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" @@ -275,7 +277,7 @@ IMPLEMENT_FUNCTION_I(11, Francois, function11, TimeValue) break; case kActionNone: - if (!getSound()->isBuffered(kEntityFrancois)) { + if (!getSoundQueue()->isBuffered(kEntityFrancois)) { UPDATE_PARAM_PROC(CURRENT_PARAM(1, 1), getState()->timeTicks, params->param6) switch (rnd(7)) { @@ -370,8 +372,8 @@ label_callback: getData()->field_4A3 = 30; getData()->inventoryItem = kItemNone; - if (getSound()->isBuffered(kEntityFrancois)) - getSound()->processEntry(kEntityFrancois); + if (getSoundQueue()->isBuffered(kEntityFrancois)) + getSoundQueue()->processEntry(kEntityFrancois); setCallback(4); setup_updateEntity(kCarRedSleeping, kPosition_5790); @@ -381,8 +383,8 @@ label_callback: case kAction1: getData()->inventoryItem = kItemNone; - if (getSound()->isBuffered(kEntityFrancois)) - getSound()->processEntry(kEntityFrancois); + if (getSoundQueue()->isBuffered(kEntityFrancois)) + getSoundQueue()->processEntry(kEntityFrancois); setCallback(6); setup_savegame(kSavegameTypeEvent, kEventFrancoisWhistle); diff --git a/engines/lastexpress/entities/gendarmes.cpp b/engines/lastexpress/entities/gendarmes.cpp index f5ae191f9d..daa50956d3 100644 --- a/engines/lastexpress/entities/gendarmes.cpp +++ b/engines/lastexpress/entities/gendarmes.cpp @@ -88,12 +88,12 @@ IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// IMPLEMENT_FUNCTION_S(5, Gendarmes, arrestPlaysound16) - arrest(savepoint, true, SoundManager::kFlagDefault); + arrest(savepoint, true, kFlagDefault); IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// IMPLEMENT_FUNCTION_I(6, Gendarmes, arrestCallback, uint32) - arrest(savepoint, true, SoundManager::kFlagInvalid, true); + arrest(savepoint, true, kFlagInvalid, true); IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// @@ -103,7 +103,7 @@ IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// IMPLEMENT_FUNCTION_II(8, Gendarmes, arrestUpdateEntity, CarIndex, EntityPosition) - arrest(savepoint, true, SoundManager::kFlagInvalid, false, true); + arrest(savepoint, true, kFlagInvalid, false, true); IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// @@ -221,7 +221,7 @@ IMPLEMENT_FUNCTION_IISS(9, Gendarmes, function9, CarIndex, EntityPosition) strcpy(arrestSound, "POL1043"); strcat(arrestSound, (char *)¶ms->seq2); - getSound()->playSound(kEntityGendarmes, arrestSound, SoundManager::kFlagInvalid, 30); + getSound()->playSound(kEntityGendarmes, arrestSound, kFlagInvalid, 30); } getData()->location = kLocationInsideCompartment; @@ -264,7 +264,7 @@ IMPLEMENT_FUNCTION_III(10, Gendarmes, function10, CarIndex, EntityPosition, Obje if (params->param6 == 0 || getState()->timeTicks > (uint32)params->param6) { params->param6 = kTimeInvalid; - getSound()->playSound(kEntityGendarmes, "POL1046A", SoundManager::kFlagDefault); + getSound()->playSound(kEntityGendarmes, "POL1046A", kFlagDefault); } UPDATE_PARAM(params->param7, getState()->timeTicks, 300); @@ -276,7 +276,7 @@ IMPLEMENT_FUNCTION_III(10, Gendarmes, function10, CarIndex, EntityPosition, Obje if (getEntities()->isOutsideAlexeiWindow()) getScenes()->loadSceneFromPosition(kCarGreenSleeping, 49); - getSound()->playSound(kEntityGendarmes, "LIB017", SoundManager::kFlagDefault); + getSound()->playSound(kEntityGendarmes, "LIB017", kFlagDefault); setCallback(getProgress().jacket == kJacketBlood ? 3 : 4); setup_savegame(kSavegameTypeEvent, getProgress().jacket == kJacketBlood ? kEventMertensBloodJacket : kEventGendarmesArrestation); @@ -312,7 +312,7 @@ IMPLEMENT_FUNCTION_III(10, Gendarmes, function10, CarIndex, EntityPosition, Obje break; case 2: - getSound()->playSound(kEntityGendarmes, "LIB014", SoundManager::kFlagDefault); + getSound()->playSound(kEntityGendarmes, "LIB014", kFlagDefault); getAction()->playAnimation(kEventGendarmesArrestation); getLogic()->gameOver(kSavegameTypeIndex, 1, kSceneGameOverPolice1, true); break; @@ -338,7 +338,7 @@ IMPLEMENT_FUNCTION_III(10, Gendarmes, function10, CarIndex, EntityPosition, Obje break; case 6: - getSound()->playSound(kEntityGendarmes, "LIB014", SoundManager::kFlagDefault); + getSound()->playSound(kEntityGendarmes, "LIB014", kFlagDefault); getAction()->playAnimation(kEventGendarmesArrestation); getLogic()->gameOver(kSavegameTypeIndex, 1, kSceneGameOverPolice1, true); break; @@ -544,7 +544,7 @@ IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// // Private functions ////////////////////////////////////////////////////////////////////////// -void Gendarmes::arrest(const SavePoint &savepoint, bool shouldPlaySound, SoundManager::FlagType flag, bool checkCallback, bool shouldUpdateEntity) { +void Gendarmes::arrest(const SavePoint &savepoint, bool shouldPlaySound, SoundFlag flag, bool checkCallback, bool shouldUpdateEntity) { switch (savepoint.action) { default: break; diff --git a/engines/lastexpress/entities/gendarmes.h b/engines/lastexpress/entities/gendarmes.h index e8f9cb2c38..d999cfc1fd 100644 --- a/engines/lastexpress/entities/gendarmes.h +++ b/engines/lastexpress/entities/gendarmes.h @@ -26,7 +26,7 @@ #include "lastexpress/entities/entity.h" #include "lastexpress/entities/entity_intern.h" -#include "lastexpress/game/sound.h" +#include "lastexpress/sound/sound.h" namespace LastExpress { @@ -88,7 +88,7 @@ public: DECLARE_FUNCTION(chapter5) private: - void arrest(const SavePoint &savepoint, bool playSound = false, SoundManager::FlagType flag = SoundManager::kFlagInvalid, bool checkCallback = false, bool shouldUpdateEntity = false); + void arrest(const SavePoint &savepoint, bool playSound = false, SoundFlag flag = kFlagInvalid, bool checkCallback = false, bool shouldUpdateEntity = false); }; } // End of namespace LastExpress diff --git a/engines/lastexpress/entities/hadija.cpp b/engines/lastexpress/entities/hadija.cpp index ce2c9718db..8ec972b939 100644 --- a/engines/lastexpress/entities/hadija.cpp +++ b/engines/lastexpress/entities/hadija.cpp @@ -26,9 +26,10 @@ #include "lastexpress/game/logic.h" #include "lastexpress/game/object.h" #include "lastexpress/game/savepoint.h" -#include "lastexpress/game/sound.h" #include "lastexpress/game/state.h" +#include "lastexpress/sound/sound.h" + #include "lastexpress/lastexpress.h" #include "lastexpress/helpers.h" diff --git a/engines/lastexpress/entities/ivo.cpp b/engines/lastexpress/entities/ivo.cpp index 35f4ccfb8c..f2261b438c 100644 --- a/engines/lastexpress/entities/ivo.cpp +++ b/engines/lastexpress/entities/ivo.cpp @@ -22,16 +22,18 @@ #include "lastexpress/entities/ivo.h" +#include "lastexpress/fight/fight.h" + #include "lastexpress/game/action.h" #include "lastexpress/game/entities.h" -#include "lastexpress/game/fight.h" #include "lastexpress/game/logic.h" #include "lastexpress/game/object.h" #include "lastexpress/game/savepoint.h" #include "lastexpress/game/scenes.h" -#include "lastexpress/game/sound.h" #include "lastexpress/game/state.h" +#include "lastexpress/sound/sound.h" + #include "lastexpress/lastexpress.h" #include "lastexpress/helpers.h" diff --git a/engines/lastexpress/entities/kahina.cpp b/engines/lastexpress/entities/kahina.cpp index 6472ce0533..2918b1e8bd 100644 --- a/engines/lastexpress/entities/kahina.cpp +++ b/engines/lastexpress/entities/kahina.cpp @@ -29,9 +29,11 @@ #include "lastexpress/game/object.h" #include "lastexpress/game/savepoint.h" #include "lastexpress/game/scenes.h" -#include "lastexpress/game/sound.h" #include "lastexpress/game/state.h" +#include "lastexpress/sound/queue.h" +#include "lastexpress/sound/sound.h" + #include "lastexpress/lastexpress.h" #include "lastexpress/helpers.h" @@ -607,8 +609,8 @@ label_callback_3: break; if (getEvent(kEventKahinaAskSpeakFirebird)) { - if (getSound()->isBuffered(kEntityKahina)) - getSound()->processEntry(kEntityKahina); + if (getSoundQueue()->isBuffered(kEntityKahina)) + getSoundQueue()->processEntry(kEntityKahina); if (savepoint.action == kActionKnock) getSound()->playSound(kEntityPlayer, "LIB012"); @@ -1163,8 +1165,8 @@ IMPLEMENT_FUNCTION(24, Kahina, function24) case 1: if (ENTITY_PARAM(0, 2)) { getEntities()->clearSequences(kEntityKahina); - if (getSound()->isBuffered(kEntityKahina)) - getSound()->processEntry(kEntityKahina); + if (getSoundQueue()->isBuffered(kEntityKahina)) + getSoundQueue()->processEntry(kEntityKahina); getProgress().field_44 = 0; @@ -1186,7 +1188,7 @@ IMPLEMENT_FUNCTION(24, Kahina, function24) getEntities()->updateEntity(kEntityKahina, kCarKronos, kPosition_9270); getEntities()->loadSceneFromEntityPosition(getData()->car, (EntityPosition)(getData()->entityPosition + 750)); getSavePoints()->push(kEntityKahina, kEntityKronos, kAction235599361); - getSound()->playSound(kEntityKahina, "MUS016", SoundManager::kFlagDefault); + getSound()->playSound(kEntityKahina, "MUS016", kFlagDefault); getProgress().field_44 = 1; params->param1 = true; @@ -1198,8 +1200,8 @@ IMPLEMENT_FUNCTION(24, Kahina, function24) case kAction137503360: getEntities()->clearSequences(kEntityKahina); - if (getSound()->isBuffered(kEntityKahina)) - getSound()->processEntry(kEntityKahina); + if (getSoundQueue()->isBuffered(kEntityKahina)) + getSoundQueue()->processEntry(kEntityKahina); getProgress().field_44 = 0; diff --git a/engines/lastexpress/entities/kronos.cpp b/engines/lastexpress/entities/kronos.cpp index 925b0967b7..134dce9c81 100644 --- a/engines/lastexpress/entities/kronos.cpp +++ b/engines/lastexpress/entities/kronos.cpp @@ -36,9 +36,11 @@ #include "lastexpress/game/object.h" #include "lastexpress/game/savepoint.h" #include "lastexpress/game/scenes.h" -#include "lastexpress/game/sound.h" #include "lastexpress/game/state.h" +#include "lastexpress/sound/queue.h" +#include "lastexpress/sound/sound.h" + #include "lastexpress/lastexpress.h" #include "lastexpress/helpers.h" @@ -216,7 +218,7 @@ IMPLEMENT_FUNCTION(11, Kronos, function11) case kActionDefault: getData()->entityPosition = kPosition_7000; - if (!getSound()->isBuffered(kEntityKronos)) + if (!getSoundQueue()->isBuffered(kEntityKronos)) getSound()->playSound(kEntityKronos, "KRO1001"); break; } @@ -457,7 +459,7 @@ IMPLEMENT_FUNCTION(19, Kronos, function19) case 2: getAction()->playAnimation(kEventConcertStart); - getSound()->setupEntry(SoundManager::kSoundType7, kEntityKronos); + getSoundQueue()->setupEntry(kSoundType7, kEntityKronos); getScenes()->loadSceneFromPosition(kCarKronos, 83); RESET_ENTITY_STATE(kEntityRebecca, Rebecca, setup_function39); @@ -480,7 +482,7 @@ IMPLEMENT_FUNCTION(20, Kronos, function20) break; case kActionNone: - params->param5 = getSound()->getEntryTime(kEntityKronos)* 2; + params->param5 = getSoundQueue()->getEntryTime(kEntityKronos)* 2; if (params->param6 < ARRAYSIZE(concertData) && params->param5 > concertData[params->param6].time) { @@ -560,8 +562,8 @@ IMPLEMENT_FUNCTION(20, Kronos, function20) case 3: getAction()->playAnimation(kEventCathFallingAsleep); - while (getSound()->isBuffered("1919.LNK")) - getSound()->updateQueue(); + while (getSoundQueue()->isBuffered("1919.LNK")) + getSoundQueue()->updateQueue(); getAction()->playAnimation(kEventCathWakingUp); getScenes()->processScene(); @@ -746,7 +748,7 @@ IMPLEMENT_FUNCTION(22, Kronos, function22) case kActionKnock: case kActionOpenDoor: - if (!getSound()->isBuffered(savepoint.action == kActionKnock ? "LIB012" : "LIB013", true)) + if (!getSoundQueue()->isBuffered(savepoint.action == kActionKnock ? "LIB012" : "LIB013", true)) getSound()->playSound(kEntityPlayer, savepoint.action == kActionKnock ? "LIB012" : "LIB013"); if (getEvent(kEventConcertLeaveWithBriefcase)) diff --git a/engines/lastexpress/entities/mahmud.cpp b/engines/lastexpress/entities/mahmud.cpp index 7d30d31a84..0e67b45cd2 100644 --- a/engines/lastexpress/entities/mahmud.cpp +++ b/engines/lastexpress/entities/mahmud.cpp @@ -31,9 +31,11 @@ #include "lastexpress/game/object.h" #include "lastexpress/game/savepoint.h" #include "lastexpress/game/scenes.h" -#include "lastexpress/game/sound.h" #include "lastexpress/game/state.h" +#include "lastexpress/sound/queue.h" +#include "lastexpress/sound/sound.h" + #include "lastexpress/lastexpress.h" #include "lastexpress/helpers.h" @@ -157,7 +159,7 @@ IMPLEMENT_FUNCTION_II(10, Mahmud, function10, ObjectIndex, bool) case kActionEndSound: case kActionDrawScene: - if (!getSound()->isBuffered(kEntityMahmud)) { + if (!getSoundQueue()->isBuffered(kEntityMahmud)) { EntityPosition position = getEntityData(kEntityPlayer)->entityPosition; if (position < kPosition_1500 || position >= kPosition_5790 || (position > kPosition_4455 && params->param5 != 5)) { getObjects()->update(kObjectCompartment5, kEntityTrain, kObjectLocation3, kCursorHandKnock, kCursorHand); @@ -173,12 +175,12 @@ IMPLEMENT_FUNCTION_II(10, Mahmud, function10, ObjectIndex, bool) case kActionKnock: case kActionOpenDoor: - if (!getSound()->isBuffered((savepoint.action == kActionKnock) ? "LIB012" : "LIB013", true)) + if (!getSoundQueue()->isBuffered((savepoint.action == kActionKnock) ? "LIB012" : "LIB013", true)) getSound()->playSound(kEntityPlayer, (savepoint.action == kActionKnock) ? "LIB012" : "LIB013"); params->param5 = savepoint.param.intValue; - if (!getSound()->isBuffered(kEntityMahmud)) { + if (!getSoundQueue()->isBuffered(kEntityMahmud)) { params->param3++; switch(params->param3) { @@ -204,7 +206,7 @@ IMPLEMENT_FUNCTION_II(10, Mahmud, function10, ObjectIndex, bool) if (getState()->time >= kTimeCityGalanta) { params->param3 = 0; } else { - getSound()->playSound(kEntityTrain, "LIB050", SoundManager::kFlagDefault); + getSound()->playSound(kEntityTrain, "LIB050", kFlagDefault); getLogic()->gameOver(kSavegameTypeIndex, 0, (getProgress().chapter == kChapter1) ? kSceneGameOverPolice1 : kSceneGameOverPolice2, true); } break; @@ -235,7 +237,7 @@ IMPLEMENT_FUNCTION_II(10, Mahmud, function10, ObjectIndex, bool) break; case kActionDefault: - getSound()->playSound(kEntityMahmud, params->param2 ? "MAH1170A" : "MAH1173", SoundManager::kFlagInvalid, 45); + getSound()->playSound(kEntityMahmud, params->param2 ? "MAH1170A" : "MAH1173", kFlagInvalid, 45); getProgress().field_C4 = 1; setCallback(1); @@ -282,7 +284,7 @@ IMPLEMENT_FUNCTION(11, Mahmud, function11) case kActionOpenDoor: { getSound()->playSound(kEntityPlayer, (savepoint.action == kActionKnock ? "LIB012" : "LIB013")); - if (!getSound()->isBuffered(kEntityMahmud)) { + if (!getSoundQueue()->isBuffered(kEntityMahmud)) { params->param1++; getSound()->playSound(kEntityMahmud, (params->param1 == 1 ? "MAH1170E" : (params->param1 == 2 ? "MAH1173B" : "MAH1174"))); @@ -396,8 +398,8 @@ IMPLEMENT_FUNCTION(11, Mahmud, function11) break; case kAction123852928: - if (getSound()->isBuffered(kEntityMahmud)) - getSound()->processEntry(kEntityMahmud); + if (getSoundQueue()->isBuffered(kEntityMahmud)) + getSoundQueue()->processEntry(kEntityMahmud); getObjects()->update(kObjectCompartment5, kEntityTrain, kObjectLocation3, kCursorHandKnock, kCursorHand); getObjects()->update(kObjectCompartment6, kEntityTrain, kObjectLocation3, kCursorHandKnock, kCursorHand); @@ -560,7 +562,7 @@ IMPLEMENT_FUNCTION(14, Mahmud, chaptersHandler) TIME_CHECK_CALLBACK(kTime1098000, params->param6, 1, setup_function13); - if (!getSound()->isBuffered("HAR1104") && getState()->time > kTime1167300 && !params->param7) { + if (!getSoundQueue()->isBuffered("HAR1104") && getState()->time > kTime1167300 && !params->param7) { params->param7 = 1; setCallback(2); @@ -636,7 +638,7 @@ IMPLEMENT_FUNCTION(14, Mahmud, chaptersHandler) params->param4 = 0; params->param5 = 0; - if (!getSound()->isBuffered("HAR1104") && getState()->time > kTime1167300 && !params->param7) { + if (!getSoundQueue()->isBuffered("HAR1104") && getState()->time > kTime1167300 && !params->param7) { params->param7 = 1; setCallback(2); setup_function12(); diff --git a/engines/lastexpress/entities/max.cpp b/engines/lastexpress/entities/max.cpp index 7e5931322d..eacc38bf60 100644 --- a/engines/lastexpress/entities/max.cpp +++ b/engines/lastexpress/entities/max.cpp @@ -28,9 +28,11 @@ #include "lastexpress/game/object.h" #include "lastexpress/game/savepoint.h" #include "lastexpress/game/scenes.h" -#include "lastexpress/game/sound.h" #include "lastexpress/game/state.h" +#include "lastexpress/sound/queue.h" +#include "lastexpress/sound/sound.h" + #include "lastexpress/lastexpress.h" #include "lastexpress/helpers.h" @@ -91,7 +93,7 @@ IMPLEMENT_FUNCTION(6, Max, chapter12_handler) case kActionNone: UPDATE_PARAM(params->param2, getState()->time, params->param1); - if (!getSound()->isBuffered(kEntityMax)) + if (!getSoundQueue()->isBuffered(kEntityMax)) getSound()->playSound(kEntityMax, "Max1122"); params->param1 = 255 * (4 * rnd(20) + 40); @@ -108,7 +110,7 @@ IMPLEMENT_FUNCTION(6, Max, chapter12_handler) break; case kAction158007856: - if (!getSound()->isBuffered(kEntityMax)) { + if (!getSoundQueue()->isBuffered(kEntityMax)) { getSound()->playSound(kEntityMax, "Max1122"); params->param1 = 255 * (4 * rnd(20) + 40); } @@ -125,7 +127,7 @@ IMPLEMENT_FUNCTION(7, Max, function7) case kActionNone: UPDATE_PARAM(params->param2, getState()->time, params->param1) - if (!getSound()->isBuffered(kEntityMax)) + if (!getSoundQueue()->isBuffered(kEntityMax)) getSound()->playSound(kEntityMax, "Max1122"); params->param1 = 255 * (4 * rnd(20) + 40); @@ -137,8 +139,8 @@ IMPLEMENT_FUNCTION(7, Max, function7) getObjects()->update(kObjectCompartmentF, kEntityMax, kObjectLocation1, kCursorNormal, kCursorNormal); getObjects()->update(kObject53, kEntityMax, kObjectLocation1, kCursorNormal, kCursorNormal); - if (getSound()->isBuffered(kEntityMax)) - getSound()->processEntry(kEntityMax); + if (getSoundQueue()->isBuffered(kEntityMax)) + getSoundQueue()->processEntry(kEntityMax); setCallback((savepoint.action == kActionKnock) ? 1 : 2); setup_playSound((savepoint.action == kActionKnock) ? "LIB012" : "LIB013"); @@ -156,7 +158,7 @@ IMPLEMENT_FUNCTION(7, Max, function7) break; case kActionDrawScene: - if (!getSound()->isBuffered(kEntityMax)) { + if (!getSoundQueue()->isBuffered(kEntityMax)) { if (getEntities()->isPlayerPosition(kCarRedSleeping, 56) || getEntities()->isPlayerPosition(kCarRedSleeping, 78)) getSound()->playSound(kEntityMax, "Max1120"); } @@ -197,7 +199,7 @@ IMPLEMENT_FUNCTION(7, Max, function7) break; case kAction158007856: - if (!getSound()->isBuffered(kEntityMax)) { + if (!getSoundQueue()->isBuffered(kEntityMax)) { getSound()->playSound(kEntityMax, "Max1122"); params->param1 = 255 * (4 * rnd(20) + 40); } @@ -214,7 +216,7 @@ IMPLEMENT_FUNCTION(8, Max, chapter4Handler) case kActionNone: UPDATE_PARAM(params->param3, getState()->time, params->param2); - if (!getSound()->isBuffered(kEntityMax)) + if (!getSoundQueue()->isBuffered(kEntityMax)) getSound()->playSound(kEntityMax, "Max3101"); params->param2 = 255 * (4 * rnd(20) + 40); @@ -228,8 +230,8 @@ IMPLEMENT_FUNCTION(8, Max, chapter4Handler) break; } - if (getSound()->isBuffered(kEntityMax)) - getSound()->processEntry(kEntityMax); + if (getSoundQueue()->isBuffered(kEntityMax)) + getSoundQueue()->processEntry(kEntityMax); getAction()->playAnimation(kEventCathMaxLickHand); getScenes()->processScene(); @@ -247,7 +249,7 @@ IMPLEMENT_FUNCTION(8, Max, chapter4Handler) getData()->location = kLocationInsideCompartment; getData()->car = kCarBaggage; - if (!getSound()->isBuffered(kEntityMax)) + if (!getSoundQueue()->isBuffered(kEntityMax)) getSound()->playSound(kEntityMax, "Max3101"); break; @@ -255,8 +257,8 @@ IMPLEMENT_FUNCTION(8, Max, chapter4Handler) if (getCallback() != 1) break; - if (getSound()->isBuffered(kEntityMax)) - getSound()->processEntry(kEntityMax); + if (getSoundQueue()->isBuffered(kEntityMax)) + getSoundQueue()->processEntry(kEntityMax); getSound()->playSound(kEntityPlayer, "LIB026"); getAction()->playAnimation(kEventCathMaxFree); @@ -392,7 +394,7 @@ IMPLEMENT_FUNCTION(13, Max, chapter3Handler) UPDATE_PARAM(params->param3, getState()->time, params->param1); - if (!getSound()->isBuffered(kEntityMax)) + if (!getSoundQueue()->isBuffered(kEntityMax)) getSound()->playSound(kEntityMax, "Max1122"); params->param1 = 255 * (4 * rnd(20) + 40); @@ -424,7 +426,7 @@ IMPLEMENT_FUNCTION(13, Max, chapter3Handler) if (params->param2) break; - if (!getSound()->isBuffered(kEntityMax)) { + if (!getSoundQueue()->isBuffered(kEntityMax)) { getSound()->playSound(kEntityMax, "Max1122"); params->param1 = 255 * (4 * rnd(20) + 40); } @@ -464,7 +466,7 @@ IMPLEMENT_FUNCTION(14, Max, freeFromCage) getData()->location = kLocationInsideCompartment; getData()->car = kCarBaggage; - if (!getSound()->isBuffered(kEntityMax)) + if (!getSoundQueue()->isBuffered(kEntityMax)) getSound()->playSound(kEntityMax, "Max1122"); break; @@ -476,17 +478,17 @@ IMPLEMENT_FUNCTION(14, Max, freeFromCage) break; case 1: - if (getSound()->isBuffered(kEntityMax)) - getSound()->removeFromQueue(kEntityMax); + if (getSoundQueue()->isBuffered(kEntityMax)) + getSoundQueue()->removeFromQueue(kEntityMax); getAction()->playAnimation(kEventCathMaxCage); - getSound()->setupEntry(SoundManager::kSoundType7, kEntityMax); + getSoundQueue()->setupEntry(kSoundType7, kEntityMax); getScenes()->processScene(); break; case 2: - if (getSound()->isBuffered(kEntityMax)) - getSound()->processEntry(kEntityMax); + if (getSoundQueue()->isBuffered(kEntityMax)) + getSoundQueue()->processEntry(kEntityMax); getSound()->playSound(kEntityPlayer, "LIB026"); getAction()->playAnimation(kEventCathMaxFree); @@ -523,7 +525,7 @@ IMPLEMENT_FUNCTION(15, Max, function15) getData()->location = kLocationOutsideCompartment; getData()->car = kCarRedSleeping; - if (!getSound()->isBuffered(kEntityMax)) + if (!getSoundQueue()->isBuffered(kEntityMax)) getSound()->playSound(kEntityMax, "Max3010"); setCallback(1); diff --git a/engines/lastexpress/entities/mertens.cpp b/engines/lastexpress/entities/mertens.cpp index 91082f487e..e222af4805 100644 --- a/engines/lastexpress/entities/mertens.cpp +++ b/engines/lastexpress/entities/mertens.cpp @@ -30,7 +30,9 @@ #include "lastexpress/game/savepoint.h" #include "lastexpress/game/scenes.h" #include "lastexpress/game/state.h" -#include "lastexpress/game/sound.h" + +#include "lastexpress/sound/queue.h" +#include "lastexpress/sound/sound.h" #include "lastexpress/lastexpress.h" #include "lastexpress/helpers.h" @@ -289,7 +291,7 @@ IMPLEMENT_FUNCTION_S(8, Mertens, playSound16) break; case kActionDefault: - getSound()->playSound(kEntityMertens, (char *)¶ms->seq1, SoundManager::kFlagDefault); + getSound()->playSound(kEntityMertens, (char *)¶ms->seq1, kFlagDefault); break; case kActionCallback: @@ -503,7 +505,7 @@ IMPLEMENT_FUNCTION_I(12, Mertens, bonsoir, EntityIndex) if (savepoint.action == kActionDefault) return; - if (getSound()->isBuffered(kEntityMertens)) { + if (getSoundQueue()->isBuffered(kEntityMertens)) { CALLBACK_ACTION(); return; } @@ -589,7 +591,7 @@ IMPLEMENT_FUNCTION_II(13, Mertens, function13, bool, bool) if (params->param2) params->param3 = 1; - if (!getSound()->isBuffered(kEntityMertens)) { + if (!getSoundQueue()->isBuffered(kEntityMertens)) { } @@ -896,7 +898,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", SoundManager::kFlagInvalid, 75); + getSound()->playSound(kEntityMertens, "CON1058", kFlagInvalid, 75); getEntities()->drawSequenceRight(kEntityMertens, "601D"); } @@ -984,7 +986,7 @@ IMPLEMENT_FUNCTION(18, Mertens, function18) getEntities()->drawSequenceRight(kEntityMertens, "601A"); } else { ENTITY_PARAM(0, 2) = 1; - getSound()->playSound(kEntityMertens, "CON1058", SoundManager::kFlagInvalid, 75); + getSound()->playSound(kEntityMertens, "CON1058", kFlagInvalid, 75); getEntities()->drawSequenceRight(kEntityMertens, "601D"); } @@ -1188,7 +1190,7 @@ IMPLEMENT_FUNCTION(22, Mertens, function22) break; case 5: - if (!getSound()->isBuffered(kEntityMertens)) + if (!getSoundQueue()->isBuffered(kEntityMertens)) getSound()->playSound(kEntityMertens, "MAH1170I"); setCallback(6); @@ -1198,8 +1200,8 @@ IMPLEMENT_FUNCTION(22, Mertens, function22) case 6: getData()->location = kLocationInsideCompartment; getEntities()->clearSequences(kEntityMertens); - if (!getSound()->isBuffered(kEntityMertens)) - getSound()->playSound(kEntityMertens, "MAH1172", SoundManager::kFlagInvalid, 225); + if (!getSoundQueue()->isBuffered(kEntityMertens)) + getSound()->playSound(kEntityMertens, "MAH1172", kFlagInvalid, 225); setCallback(7); setup_function21(kObjectCompartment4, kObject20); @@ -2300,7 +2302,7 @@ IMPLEMENT_FUNCTION_I(31, Mertens, function31, MertensActionType) break; case 1: - if (getSound()->isBuffered(kEntityMertens)) { + if (getSoundQueue()->isBuffered(kEntityMertens)) { getEntities()->drawSequenceLeft(kEntityMertens, "601J"); } else { setCallback(2); @@ -3017,7 +3019,7 @@ IMPLEMENT_FUNCTION(42, Mertens, function42) if (getState()->time <= kTime1188000) { if ((!getEntities()->isPlayerInCar(kCarGreenSleeping) && !getEntities()->isPlayerInCar(kCarRedSleeping)) - || getSound()->isBuffered("REB1205") + || getSoundQueue()->isBuffered("REB1205") || !getEntities()->isInsideCompartment(kEntityMmeBoutarel, kCarRedSleeping, kPosition_5790) || !params->param4) { params->param4 = (uint)getState()->time; @@ -3138,7 +3140,7 @@ label_callback_18: } label_callback_19: - if (ENTITY_PARAM(0, 1) && !getSound()->isBuffered(kEntityMertens)) { + if (ENTITY_PARAM(0, 1) && !getSoundQueue()->isBuffered(kEntityMertens)) { if (getProgress().field_18 != 4) getSound()->playSound(kEntityMertens, "CON1505"); } diff --git a/engines/lastexpress/entities/milos.cpp b/engines/lastexpress/entities/milos.cpp index 587c43cade..ff3d2b6744 100644 --- a/engines/lastexpress/entities/milos.cpp +++ b/engines/lastexpress/entities/milos.cpp @@ -24,17 +24,20 @@ #include "lastexpress/entities/vesna.h" +#include "lastexpress/fight/fight.h" + #include "lastexpress/game/action.h" #include "lastexpress/game/entities.h" -#include "lastexpress/game/fight.h" #include "lastexpress/game/inventory.h" #include "lastexpress/game/logic.h" #include "lastexpress/game/object.h" #include "lastexpress/game/savepoint.h" #include "lastexpress/game/scenes.h" -#include "lastexpress/game/sound.h" #include "lastexpress/game/state.h" +#include "lastexpress/sound/queue.h" +#include "lastexpress/sound/sound.h" + #include "lastexpress/lastexpress.h" #include "lastexpress/helpers.h" @@ -110,7 +113,7 @@ IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// IMPLEMENT_FUNCTION_S(7, Milos, playSound16) - Entity::playSound(savepoint, false, SoundManager::kFlagDefault); + Entity::playSound(savepoint, false, kFlagDefault); IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// @@ -1576,8 +1579,8 @@ IMPLEMENT_FUNCTION(29, Milos, chapter4Handler) break; case kAction221683008: - if (getSound()->isBuffered(kEntityMilos)) - getSound()->processEntry(kEntityMilos); + if (getSoundQueue()->isBuffered(kEntityMilos)) + getSoundQueue()->processEntry(kEntityMilos); params->param1 = 1; getSavePoints()->push(kEntityMilos, kEntityCoudert, kAction123199584); @@ -1719,15 +1722,15 @@ IMPLEMENT_FUNCTION(34, Milos, chapter5Handler) break; case 2: - if (getSound()->isBuffered("MUS050")) - getSound()->processEntry("MUS050"); + if (getSoundQueue()->isBuffered("MUS050")) + getSoundQueue()->processEntry("MUS050"); - if (getSound()->isBuffered("ARRIVE")) - getSound()->removeFromQueue("ARRIVE"); + if (getSoundQueue()->isBuffered("ARRIVE")) + getSoundQueue()->removeFromQueue("ARRIVE"); - getSound()->processEntries(); + getSoundQueue()->processEntries(); getAction()->playAnimation(isNight() ? kEventLocomotiveMilosNight : kEventLocomotiveMilosDay); - getSound()->setupEntry(SoundManager::kSoundType7, kEntityMilos); + getSoundQueue()->setupEntry(kSoundType7, kEntityMilos); getScenes()->loadSceneFromPosition(kCarCoalTender, 1); break; @@ -1739,7 +1742,7 @@ IMPLEMENT_FUNCTION(34, Milos, chapter5Handler) case 4: getAction()->playAnimation(kEventLocomotiveRestartTrain); getAction()->playAnimation(kEventLocomotiveOldBridge); - getSound()->resetState(); + getSoundQueue()->resetState(); getState()->time = kTime2983500; setCallback(5); @@ -1782,7 +1785,7 @@ IMPLEMENT_FUNCTION(34, Milos, chapter5Handler) setup_savegame(kSavegameTypeEvent, kEventLocomotiveAnnaStopsTrain); } - getSound()->processEntry(kEntityMilos); + getSoundQueue()->processEntry(kEntityMilos); if (getState()->time < kTimeTrainStopped2) getState()->time = kTimeTrainStopped2; diff --git a/engines/lastexpress/entities/mmeboutarel.cpp b/engines/lastexpress/entities/mmeboutarel.cpp index 78f2d2fb4b..9ca10ca374 100644 --- a/engines/lastexpress/entities/mmeboutarel.cpp +++ b/engines/lastexpress/entities/mmeboutarel.cpp @@ -28,9 +28,11 @@ #include "lastexpress/game/object.h" #include "lastexpress/game/savepoint.h" #include "lastexpress/game/scenes.h" -#include "lastexpress/game/sound.h" #include "lastexpress/game/state.h" +#include "lastexpress/sound/queue.h" +#include "lastexpress/sound/sound.h" + #include "lastexpress/lastexpress.h" #include "lastexpress/helpers.h" @@ -399,7 +401,7 @@ IMPLEMENT_FUNCTION(13, MmeBoutarel, function13) break; case kActionNone: - if (!getSound()->isBuffered(kEntityMmeBoutarel) && params->param6 != kTimeInvalid) { + if (!getSoundQueue()->isBuffered(kEntityMmeBoutarel) && params->param6 != kTimeInvalid) { UPDATE_PARAM_PROC_TIME(params->param1, !getEntities()->isDistanceBetweenEntities(kEntityMmeBoutarel, kEntityPlayer, 2000), params->param6, 0) getObjects()->update(kObjectCompartmentD, kEntityPlayer, kObjectLocation1, kCursorNormal, kCursorNormal); getObjects()->update(kObject51, kEntityPlayer, kObjectLocation1, kCursorNormal, kCursorNormal); @@ -883,8 +885,8 @@ IMPLEMENT_FUNCTION(21, MmeBoutarel, chapter3Handler) if (getState()->time <= kTime2038500) { if (!getEntities()->isPlayerInCar(kCarRedSleeping) || !params->param1 - || getSound()->isBuffered("FRA2012") - || getSound()->isBuffered("FRA2010") + || getSoundQueue()->isBuffered("FRA2012") + || getSoundQueue()->isBuffered("FRA2010") ||!params->param2) params->param2 = (uint)getState()->time; diff --git a/engines/lastexpress/entities/pascale.cpp b/engines/lastexpress/entities/pascale.cpp index 7cf7f7766e..a191273702 100644 --- a/engines/lastexpress/entities/pascale.cpp +++ b/engines/lastexpress/entities/pascale.cpp @@ -27,9 +27,11 @@ #include "lastexpress/game/object.h" #include "lastexpress/game/savepoint.h" #include "lastexpress/game/scenes.h" -#include "lastexpress/game/sound.h" #include "lastexpress/game/state.h" +#include "lastexpress/sound/queue.h" +#include "lastexpress/sound/sound.h" + #include "lastexpress/lastexpress.h" #include "lastexpress/helpers.h" @@ -141,15 +143,15 @@ IMPLEMENT_FUNCTION(8, Pascale, welcomeSophieAndRebecca) break; case kChapter1: - getSound()->playSound(kEntityPascale, "REB1198", SoundManager::kFlagInvalid, 30); + getSound()->playSound(kEntityPascale, "REB1198", kFlagInvalid, 30); break; case kChapter3: - getSound()->playSound(kEntityPascale, "REB3001", SoundManager::kFlagInvalid, 30); + getSound()->playSound(kEntityPascale, "REB3001", kFlagInvalid, 30); break; case kChapter4: - getSound()->playSound(kEntityPascale, "REB4001", SoundManager::kFlagInvalid, 30); + getSound()->playSound(kEntityPascale, "REB4001", kFlagInvalid, 30); break; } @@ -201,7 +203,7 @@ IMPLEMENT_FUNCTION(10, Pascale, welcomeCath) break; case kActionNone: - if (params->param1 && !getSound()->isBuffered(kEntityPascale)) + if (params->param1 && !getSoundQueue()->isBuffered(kEntityPascale)) getEntities()->updatePositionExit(kEntityPascale, kCarRestaurant, 64); break; @@ -462,10 +464,10 @@ IMPLEMENT_FUNCTION(16, Pascale, serveTatianaVassili) getEntities()->drawSequenceLeft(kEntityPascale, "014B"); getEntities()->updatePositionEnter(kEntityPascale, kCarRestaurant, 67); - if (getSound()->isBuffered("TAT1069A")) - getSound()->processEntry("TAT1069A"); - else if (getSound()->isBuffered("TAT1069B")) - getSound()->processEntry("TAT1069B"); + if (getSoundQueue()->isBuffered("TAT1069A")) + getSoundQueue()->processEntry("TAT1069A"); + else if (getSoundQueue()->isBuffered("TAT1069B")) + getSoundQueue()->processEntry("TAT1069B"); setCallback(2); setup_playSound("TAT1066"); @@ -754,7 +756,7 @@ IMPLEMENT_FUNCTION(24, Pascale, welcomeAbbot) break; case kActionDefault: - getSound()->playSound(kEntityPascale, "ABB3015", SoundManager::kFlagInvalid, 105); + getSound()->playSound(kEntityPascale, "ABB3015", kFlagInvalid, 105); getEntities()->drawSequenceRight(kEntityPascale, "029A1"); getEntities()->drawSequenceRight(kEntityAbbot, "029A2"); break; @@ -1213,7 +1215,7 @@ label_callback1: break; case kAction169750080: - if (getSound()->isBuffered(kEntityPascale)) { + if (getSoundQueue()->isBuffered(kEntityPascale)) { params->param4 = 1; } else { setCallback(7); diff --git a/engines/lastexpress/entities/rebecca.cpp b/engines/lastexpress/entities/rebecca.cpp index 1cb895d8d6..b1a176b47e 100644 --- a/engines/lastexpress/entities/rebecca.cpp +++ b/engines/lastexpress/entities/rebecca.cpp @@ -27,9 +27,11 @@ #include "lastexpress/game/object.h" #include "lastexpress/game/savepoint.h" #include "lastexpress/game/scenes.h" -#include "lastexpress/game/sound.h" #include "lastexpress/game/state.h" +#include "lastexpress/sound/queue.h" +#include "lastexpress/sound/sound.h" + #include "lastexpress/lastexpress.h" #include "lastexpress/helpers.h" @@ -316,7 +318,7 @@ IMPLEMENT_FUNCTION_I(17, Rebecca, function17, bool) getData()->location = kLocationOutsideCompartment; if (getProgress().chapter == kChapter3) - getSound()->playSound(kEntityRebecca, "Reb3005", SoundManager::kFlagInvalid, 75); + getSound()->playSound(kEntityRebecca, "Reb3005", kFlagInvalid, 75); if (params->param1) { setCallback(5); @@ -511,7 +513,7 @@ IMPLEMENT_FUNCTION_I(20, Rebecca, function20, TimeValue) if (getProgress().chapter == kChapter1 && !ENTITY_PARAM(0, 3)) { if (params->param7 != kTimeInvalid && getState()->time > kTime1174500) { if (getState()->time <= kTime1183500) { - if (!getEntities()->isDistanceBetweenEntities(kEntityRebecca, kEntityPlayer, 2000) || getSound()->isBuffered("CON1210") || !params->param7) + if (!getEntities()->isDistanceBetweenEntities(kEntityRebecca, kEntityPlayer, 2000) || getSoundQueue()->isBuffered("CON1210") || !params->param7) params->param7 = (uint)(getState()->time); if (params->param7 >= getState()->time) @@ -1357,7 +1359,7 @@ label_callback_3: params->param5 = kTimeInvalid; getData()->inventoryItem = kItemNone; - getSound()->playSound(kEntityRebecca, "Reb3008", SoundManager::kFlagInvalid, 60); + getSound()->playSound(kEntityRebecca, "Reb3008", kFlagInvalid, 60); getEntities()->updatePositionEnter(kEntityRebecca, kCarRestaurant, 52); setCallback(3); diff --git a/engines/lastexpress/entities/salko.cpp b/engines/lastexpress/entities/salko.cpp index 4d510bb9bf..63d995dc42 100644 --- a/engines/lastexpress/entities/salko.cpp +++ b/engines/lastexpress/entities/salko.cpp @@ -22,16 +22,19 @@ #include "lastexpress/entities/salko.h" +#include "lastexpress/fight/fight.h" + #include "lastexpress/game/action.h" #include "lastexpress/game/entities.h" -#include "lastexpress/game/fight.h" #include "lastexpress/game/logic.h" #include "lastexpress/game/object.h" #include "lastexpress/game/savepoint.h" #include "lastexpress/game/scenes.h" -#include "lastexpress/game/sound.h" #include "lastexpress/game/state.h" +#include "lastexpress/sound/queue.h" +#include "lastexpress/sound/sound.h" + #include "lastexpress/lastexpress.h" #include "lastexpress/helpers.h" @@ -595,8 +598,8 @@ IMPLEMENT_FUNCTION(24, Salko, chapter5Handler) break; case 1: - if (getSound()->isBuffered("MUS050")) - getSound()->processEntry("MUS050"); + if (getSoundQueue()->isBuffered("MUS050")) + getSoundQueue()->processEntry("MUS050"); getAction()->playAnimation(kEventCathSalkoTrainTopFight); diff --git a/engines/lastexpress/entities/servers0.cpp b/engines/lastexpress/entities/servers0.cpp index 1fec775659..989bddd662 100644 --- a/engines/lastexpress/entities/servers0.cpp +++ b/engines/lastexpress/entities/servers0.cpp @@ -26,9 +26,10 @@ #include "lastexpress/game/logic.h" #include "lastexpress/game/object.h" #include "lastexpress/game/savepoint.h" -#include "lastexpress/game/sound.h" #include "lastexpress/game/state.h" +#include "lastexpress/sound/sound.h" + #include "lastexpress/lastexpress.h" #include "lastexpress/helpers.h" diff --git a/engines/lastexpress/entities/servers1.cpp b/engines/lastexpress/entities/servers1.cpp index cd0a162755..995fbbc01b 100644 --- a/engines/lastexpress/entities/servers1.cpp +++ b/engines/lastexpress/entities/servers1.cpp @@ -26,9 +26,10 @@ #include "lastexpress/game/logic.h" #include "lastexpress/game/object.h" #include "lastexpress/game/savepoint.h" -#include "lastexpress/game/sound.h" #include "lastexpress/game/state.h" +#include "lastexpress/sound/sound.h" + #include "lastexpress/lastexpress.h" #include "lastexpress/helpers.h" diff --git a/engines/lastexpress/entities/sophie.cpp b/engines/lastexpress/entities/sophie.cpp index e0c63f7297..57bd491949 100644 --- a/engines/lastexpress/entities/sophie.cpp +++ b/engines/lastexpress/entities/sophie.cpp @@ -25,9 +25,10 @@ #include "lastexpress/game/entities.h" #include "lastexpress/game/logic.h" #include "lastexpress/game/savepoint.h" -#include "lastexpress/game/sound.h" #include "lastexpress/game/state.h" +#include "lastexpress/sound/sound.h" + #include "lastexpress/helpers.h" #include "lastexpress/lastexpress.h" diff --git a/engines/lastexpress/entities/tables.cpp b/engines/lastexpress/entities/tables.cpp index c372663c40..06ea4c597c 100644 --- a/engines/lastexpress/entities/tables.cpp +++ b/engines/lastexpress/entities/tables.cpp @@ -26,9 +26,11 @@ #include "lastexpress/game/logic.h" #include "lastexpress/game/object.h" #include "lastexpress/game/savepoint.h" -#include "lastexpress/game/sound.h" #include "lastexpress/game/state.h" +#include "lastexpress/sound/queue.h" +#include "lastexpress/sound/sound.h" + #include "lastexpress/lastexpress.h" #include "lastexpress/helpers.h" @@ -49,7 +51,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", SoundManager::kFlagLoop, kEntityTables2); + getSound()->playSoundWithSubtitles("LOOP8A.SND", kFlagLoop, kEntityTables2); setup_draw(); } @@ -59,7 +61,7 @@ IMPLEMENT_FUNCTION_END IMPLEMENT_FUNCTION(2, Tables, chapter2) if (savepoint.action == kActionDefault) { if (_id == kEntityTables2) - getSound()->playSoundWithSubtitles("LOOP8A.SND", SoundManager::kFlagLoop, kEntityTables2); + getSound()->playSoundWithSubtitles("LOOP8A.SND", kFlagLoop, kEntityTables2); setup_draw(); } @@ -69,7 +71,7 @@ IMPLEMENT_FUNCTION_END IMPLEMENT_FUNCTION(3, Tables, chapter3) if (savepoint.action == kActionDefault) { if (_id == kEntityTables2) - getSound()->playSoundWithSubtitles("LOOP8A.SND", SoundManager::kFlagLoop, kEntityTables2); + getSound()->playSoundWithSubtitles("LOOP8A.SND", kFlagLoop, kEntityTables2); setup_draw(); } @@ -79,7 +81,7 @@ IMPLEMENT_FUNCTION_END IMPLEMENT_FUNCTION(4, Tables, chapter4) if (savepoint.action == kActionDefault) { if (_id == kEntityTables2) - getSound()->playSoundWithSubtitles("LOOP8A.SND", SoundManager::kFlagLoop, kEntityTables2); + getSound()->playSoundWithSubtitles("LOOP8A.SND", kFlagLoop, kEntityTables2); setup_draw(); } @@ -88,8 +90,8 @@ IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// IMPLEMENT_FUNCTION(5, Tables, chapter5) if (savepoint.action == kActionDefault) { - if (_id == kEntityTables2 && getSound()->isBuffered(kEntityTables2)) - getSound()->processEntry(kEntityTables2); + if (_id == kEntityTables2 && getSoundQueue()->isBuffered(kEntityTables2)) + getSoundQueue()->processEntry(kEntityTables2); setup_draw(); } @@ -113,21 +115,21 @@ IMPLEMENT_FUNCTION(6, Tables, draw) case kChapter1: if (getState()->time > kTime1165500 && !params->param1) { params->param1 = 1; - getSound()->processEntry(kEntityTables2); + getSoundQueue()->processEntry(kEntityTables2); } break; case kChapter3: if (getState()->time > kTime2052000 && !params->param2) { params->param2 = 1; - getSound()->processEntry(kEntityTables2); + getSoundQueue()->processEntry(kEntityTables2); } break; case kChapter4: if (getState()->time > kTime2488500 && !params->param3) { params->param3 = 1; - getSound()->processEntry(kEntityTables2); + getSoundQueue()->processEntry(kEntityTables2); } break; diff --git a/engines/lastexpress/entities/tatiana.cpp b/engines/lastexpress/entities/tatiana.cpp index 6e25d8c5c7..c8901b3e30 100644 --- a/engines/lastexpress/entities/tatiana.cpp +++ b/engines/lastexpress/entities/tatiana.cpp @@ -32,9 +32,11 @@ #include "lastexpress/game/object.h" #include "lastexpress/game/savepoint.h" #include "lastexpress/game/scenes.h" -#include "lastexpress/game/sound.h" #include "lastexpress/game/state.h" +#include "lastexpress/sound/queue.h" +#include "lastexpress/sound/sound.h" + #include "lastexpress/lastexpress.h" #include "lastexpress/helpers.h" @@ -420,7 +422,7 @@ IMPLEMENT_FUNCTION(19, Tatiana, chapter1Handler) break; case kActionNone: - if (getSound()->isBuffered(kEntityTatiana) || !params->param4 || params->param3 == 2 || getSound()->isBuffered("TAT1066")) + if (getSoundQueue()->isBuffered(kEntityTatiana) || !params->param4 || params->param3 == 2 || getSoundQueue()->isBuffered("TAT1066")) goto label_tatiana_chapter1_2; UPDATE_PARAM_PROC(params->param5, getState()->timeTicks, 450) @@ -568,7 +570,7 @@ IMPLEMENT_FUNCTION(21, Tatiana, function21) // Fallback to next case case 3: - if (getSound()->isBuffered(kEntityTatiana)) { + if (getSoundQueue()->isBuffered(kEntityTatiana)) { setCallback(3); setup_updateFromTime(75); } else { @@ -1858,7 +1860,7 @@ IMPLEMENT_FUNCTION(46, Tatiana, function46) parameters->param3 = 1; if (parameters->param2) { - getSound()->removeFromQueue(kEntityTatiana); + getSoundQueue()->removeFromQueue(kEntityTatiana); getSavePoints()->call(kEntityTatiana, kEntityTatiana, kActionEndSound); } } else { @@ -1947,12 +1949,12 @@ IMPLEMENT_FUNCTION(48, Tatiana, function48) params->param1 = 0; } - if (!params->param1 || getSound()->isBuffered(kEntityTatiana)) + if (!params->param1 || getSoundQueue()->isBuffered(kEntityTatiana)) goto label_end; UPDATE_PARAM_GOTO(params->param2, getState()->timeTicks, 5 * (3 * rnd(5) + 30), label_end); - getSound()->playSound(kEntityTatiana, "LIB012", SoundManager::kFlagDefault); + getSound()->playSound(kEntityTatiana, "LIB012", kFlagDefault); params->param2 = 0; label_end: @@ -2086,7 +2088,7 @@ IMPLEMENT_FUNCTION(50, Tatiana, function50) break; case kActionKnock: - if (!getSound()->isBuffered("LIB012", true)) + if (!getSoundQueue()->isBuffered("LIB012", true)) getSound()->playSound(kEntityPlayer, "LIB012"); break; @@ -2107,14 +2109,14 @@ IMPLEMENT_FUNCTION(50, Tatiana, function50) getObjects()->update(kObject48, kEntityTatiana, kObjectLocationNone, kCursorHandKnock, kCursorHand); getObjects()->update(kObjectCompartmentA, kEntityTatiana, kObjectLocationNone, kCursorHandKnock, kCursorHand); - if (!getSound()->isBuffered(kEntityTatiana)) + if (!getSoundQueue()->isBuffered(kEntityTatiana)) getSound()->playSound(kEntityTatiana, "Tat4166"); break; case kActionCallback: if (getCallback() == 1) { - if (getSound()->isBuffered("MUS013")) - getSound()->processEntry("MUS013"); + if (getSoundQueue()->isBuffered("MUS013")) + getSoundQueue()->processEntry("MUS013"); getAction()->playAnimation(kEventVassiliDeadAlexei); getSavePoints()->push(kEntityTatiana, kEntityAbbot, kAction104060776); @@ -2223,11 +2225,11 @@ IMPLEMENT_FUNCTION(54, Tatiana, function54) case kActionCallback: if (getCallback() == 1) { - if (getSound()->isBuffered("MUS050")) - getSound()->processEntry("MUS050"); + if (getSoundQueue()->isBuffered("MUS050")) + getSoundQueue()->processEntry("MUS050"); - if (getSound()->isBuffered(kEntityTatiana)) - getSound()->processEntry(kEntityTatiana); + if (getSoundQueue()->isBuffered(kEntityTatiana)) + getSoundQueue()->processEntry(kEntityTatiana); getAction()->playAnimation(isNight() ? kEventTatianaVassiliTalkNight : kEventTatianaVassiliTalk); getScenes()->processScene(); diff --git a/engines/lastexpress/entities/train.cpp b/engines/lastexpress/entities/train.cpp index 19c6fe279c..bced1da62b 100644 --- a/engines/lastexpress/entities/train.cpp +++ b/engines/lastexpress/entities/train.cpp @@ -30,7 +30,9 @@ #include "lastexpress/game/savepoint.h" #include "lastexpress/game/scenes.h" #include "lastexpress/game/state.h" -#include "lastexpress/game/sound.h" + +#include "lastexpress/sound/queue.h" +#include "lastexpress/sound/sound.h" #include "lastexpress/lastexpress.h" #include "lastexpress/helpers.h" @@ -90,7 +92,7 @@ IMPLEMENT_FUNCTION_II(7, Train, harem, ObjectIndex, uint32) switch (params->param1) { default: - error("Train::harem: Invalid value for parameter 1: %d", params->param1); + error("[Train::harem] Invalid value for parameter 1: %d", params->param1); break; case kObjectCompartment5: @@ -118,7 +120,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", SoundManager::kFlagDefault); + getSound()->playSound(kEntityTables5, (params->param2 == 8) ? "LIB012" : "LIB013", kFlagDefault); if (params->param4 && params->param5) { @@ -130,17 +132,17 @@ IMPLEMENT_FUNCTION_II(7, Train, harem, ObjectIndex, uint32) break; case 1: - getSound()->playSound(kEntityTables5, "Har1014", SoundManager::kFlagDefault, 15); + getSound()->playSound(kEntityTables5, "Har1014", kFlagDefault, 15); break; case 2: - getSound()->playSound(kEntityTables5, "Har1013", SoundManager::kFlagDefault, 15); - getSound()->playSound(kEntityTables5, "Har1016", SoundManager::kFlagDefault, 150); + getSound()->playSound(kEntityTables5, "Har1013", kFlagDefault, 15); + getSound()->playSound(kEntityTables5, "Har1016", kFlagDefault, 150); break; case 3: - getSound()->playSound(kEntityTables5, "Har1015A", SoundManager::kFlagDefault, 15); - getSound()->playSound(kEntityTables5, "Har1015", SoundManager::kFlagDefault, 150); + getSound()->playSound(kEntityTables5, "Har1015A", kFlagDefault, 15); + getSound()->playSound(kEntityTables5, "Har1015", kFlagDefault, 150); break; } @@ -164,15 +166,15 @@ IMPLEMENT_FUNCTION_II(7, Train, harem, ObjectIndex, uint32) break; case 1: - getSound()->playSound(kEntityTables5, "Har1014", SoundManager::kFlagDefault, 15); + getSound()->playSound(kEntityTables5, "Har1014", kFlagDefault, 15); break; case 2: - getSound()->playSound(kEntityTables5, "Har1013", SoundManager::kFlagDefault, 15); + getSound()->playSound(kEntityTables5, "Har1013", kFlagDefault, 15); break; case 3: - getSound()->playSound(kEntityTables5, "Har1013A", SoundManager::kFlagDefault, 15); + getSound()->playSound(kEntityTables5, "Har1013A", kFlagDefault, 15); break; } @@ -191,11 +193,11 @@ IMPLEMENT_FUNCTION_II(7, Train, harem, ObjectIndex, uint32) break; case 1: - getSound()->playSound(kEntityTables5, "Har1012", SoundManager::kFlagDefault, 15); + getSound()->playSound(kEntityTables5, "Har1012", kFlagDefault, 15); break; case 2: - getSound()->playSound(kEntityTables5, "Har1012A", SoundManager::kFlagDefault, 15); + getSound()->playSound(kEntityTables5, "Har1012A", kFlagDefault, 15); break; } @@ -207,7 +209,7 @@ IMPLEMENT_FUNCTION_II(7, Train, harem, ObjectIndex, uint32) ENTITY_PARAM(0, 1)++; if (ENTITY_PARAM(0, 1) <= 1) - getSound()->playSound(kEntityTables5, "Har1014", SoundManager::kFlagDefault, 15); + getSound()->playSound(kEntityTables5, "Har1014", kFlagDefault, 15); else params->param8 = 1; @@ -221,7 +223,7 @@ IMPLEMENT_FUNCTION_II(7, Train, harem, ObjectIndex, uint32) ENTITY_PARAM(0, 4)++; if (ENTITY_PARAM(0, 4) <= 1) { - getSound()->playSound(kEntityTables5, "Har1011", SoundManager::kFlagDefault, 15); + getSound()->playSound(kEntityTables5, "Har1011", kFlagDefault, 15); handleCompartmentAction(); return; } @@ -241,11 +243,11 @@ IMPLEMENT_FUNCTION_II(7, Train, harem, ObjectIndex, uint32) break; case 1: - getSound()->playSound(kEntityTables5, "Har1013", SoundManager::kFlagDefault, 15); + getSound()->playSound(kEntityTables5, "Har1013", kFlagDefault, 15); break; case 2: - getSound()->playSound(kEntityTables5, "Har1013A", SoundManager::kFlagDefault, 15); + getSound()->playSound(kEntityTables5, "Har1013A", kFlagDefault, 15); break; } @@ -300,13 +302,13 @@ label_process: } // Update object - if (ENTITY_PARAM(0, 8) && !getSound()->isBuffered(kEntityTables5)) { + if (ENTITY_PARAM(0, 8) && !getSoundQueue()->isBuffered(kEntityTables5)) { getObjects()->update((ObjectIndex)ENTITY_PARAM(0, 8), getObjects()->get((ObjectIndex)ENTITY_PARAM(0, 8)).entity, kObjectLocation3, kCursorHandKnock, kCursorHand); ENTITY_PARAM(0, 8) = 0; } // Play clock sound - if (params->param6 && !getSound()->isBuffered("ZFX1001", true)) + if (params->param6 && !getSoundQueue()->isBuffered("ZFX1001", true)) getSound()->playSound(kEntityPlayer, "ZFX1001"); break; @@ -339,12 +341,12 @@ label_process: // Play clock sound if (getEntities()->isPlayerPosition(kCarRestaurant, 81)) { params->param6 = 1; - if (!getSound()->isBuffered("ZFX1001")) + if (!getSoundQueue()->isBuffered("ZFX1001")) getSound()->playSound(kEntityPlayer, "ZFX1001"); } else { params->param6 = 0; - if (getSound()->isBuffered("ZFX1001", true)) - getSound()->removeFromQueue("ZFX1001"); + if (getSoundQueue()->isBuffered("ZFX1001", true)) + getSoundQueue()->removeFromQueue("ZFX1001"); } // Draw moving background behind windows @@ -562,8 +564,8 @@ void Train::resetParam8() { && !getEntities()->isInsideCompartment(kEntityPlayer, (CarIndex)params1->param1, (EntityPosition)params1->param2) && !getEntities()->isInsideCompartment(kEntityPlayer, (CarIndex)params1->param1, (EntityPosition)params1->param3)) { - if (getSound()->isBuffered((const char *)¶ms1->seq)) - getSound()->processEntry((const char *)¶ms1->seq); + if (getSoundQueue()->isBuffered((const char *)¶ms1->seq)) + getSoundQueue()->processEntry((const char *)¶ms1->seq); params->param8 = 0; } diff --git a/engines/lastexpress/entities/vassili.cpp b/engines/lastexpress/entities/vassili.cpp index 09fb5b1223..22f41afa92 100644 --- a/engines/lastexpress/entities/vassili.cpp +++ b/engines/lastexpress/entities/vassili.cpp @@ -32,9 +32,11 @@ #include "lastexpress/game/object.h" #include "lastexpress/game/savepoint.h" #include "lastexpress/game/scenes.h" -#include "lastexpress/game/sound.h" #include "lastexpress/game/state.h" +#include "lastexpress/sound/queue.h" +#include "lastexpress/sound/sound.h" + #include "lastexpress/lastexpress.h" #include "lastexpress/helpers.h" @@ -268,7 +270,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", SoundManager::kFlagDefault); + getSound()->playSound(kEntityVassili, "VAS1027", kFlagDefault); break; } IMPLEMENT_FUNCTION_END @@ -295,12 +297,12 @@ IMPLEMENT_FUNCTION(9, Vassili, function9) || getEntities()->isPlayerPosition(kCarRedSleeping, 41)) { if (savepoint.action == kActionDrawScene) - getSound()->processEntry(kEntityVassili); + getSoundQueue()->processEntry(kEntityVassili); setup_seizure(); } else { if (savepoint.action == kActionDefault) - getSound()->playSound(kEntityVassili, "VAS1028", SoundManager::kFlagDefault); + getSound()->playSound(kEntityVassili, "VAS1028", kFlagDefault); } break; } diff --git a/engines/lastexpress/entities/verges.cpp b/engines/lastexpress/entities/verges.cpp index bc35a105b1..8246f85145 100644 --- a/engines/lastexpress/entities/verges.cpp +++ b/engines/lastexpress/entities/verges.cpp @@ -29,9 +29,11 @@ #include "lastexpress/game/object.h" #include "lastexpress/game/savepoint.h" #include "lastexpress/game/scenes.h" -#include "lastexpress/game/sound.h" #include "lastexpress/game/state.h" +#include "lastexpress/sound/queue.h" +#include "lastexpress/sound/sound.h" + #include "lastexpress/lastexpress.h" #include "lastexpress/helpers.h" @@ -123,7 +125,7 @@ IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// IMPLEMENT_FUNCTION_NOSETUP(5, Verges, playSound16) - Entity::playSound(savepoint, false, SoundManager::kFlagDefault); + Entity::playSound(savepoint, false, kFlagDefault); IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// @@ -139,7 +141,7 @@ IMPLEMENT_FUNCTION_END ////////////////////////////////////////////////////////////////////////// IMPLEMENT_FUNCTION_II(8, Verges, updateEntity, CarIndex, EntityPosition) if (savepoint.action == kActionExcuseMeCath) { - if (!getSound()->isBuffered(kEntityVerges)) + if (!getSoundQueue()->isBuffered(kEntityVerges)) getSound()->playSound(kEntityPlayer, "TRA1113", getSound()->getSoundFlag(kEntityVerges)); return; @@ -187,7 +189,7 @@ switch (savepoint.action) { break; case 2: - if (!getSound()->isBuffered(kEntityVerges)) + if (!getSoundQueue()->isBuffered(kEntityVerges)) getSound()->playSound(kEntityVerges, (char *)¶ms->seq1); getEntities()->drawSequenceRight(kEntityVerges, "813DS"); @@ -232,7 +234,7 @@ IMPLEMENT_FUNCTION_IIS(10, Verges, function10, CarIndex, EntityPosition) case kActionNone: if (!params->param7) { - if (!getSound()->isBuffered(kEntityVerges)) { + if (!getSoundQueue()->isBuffered(kEntityVerges)) { getSound()->playSound(kEntityVerges, (char *)¶ms->seq); params->param7 = 1; } @@ -258,7 +260,7 @@ IMPLEMENT_FUNCTION_IIS(10, Verges, function10, CarIndex, EntityPosition) break; case kActionDefault: - if (!getSound()->isBuffered(kEntityVerges)) { + if (!getSoundQueue()->isBuffered(kEntityVerges)) { getSound()->playSound(kEntityVerges, (char *)¶ms->seq); params->param7 = 1; } @@ -699,12 +701,12 @@ IMPLEMENT_FUNCTION(24, Verges, policeGettingOffTrain) break; case kActionDefault: - getSound()->playSound(kEntityVerges, "POL1101", SoundManager::kFlagDefault); + getSound()->playSound(kEntityVerges, "POL1101", kFlagDefault); break; case kActionCallback: if (getCallback() == 1) { - getSound()->processEntry(kEntityVerges); + getSoundQueue()->processEntry(kEntityVerges); getAction()->playAnimation(kEventGendarmesArrestation); getLogic()->gameOver(kSavegameTypeIndex, 1, kSceneGameOverPolice1, true); } @@ -1314,7 +1316,7 @@ IMPLEMENT_FUNCTION(32, Verges, function32) break; case 2: - if (!getSound()->isBuffered(kEntityVerges)) + if (!getSoundQueue()->isBuffered(kEntityVerges)) getSound()->playSound(kEntityVerges, "TRA3004"); getEntities()->drawSequenceRight(kEntityVerges, "813DS"); @@ -1752,16 +1754,16 @@ IMPLEMENT_FUNCTION(40, Verges, chapter5Handler) break; case kActionNone: - if (getEntities()->isInSalon(kEntityPlayer) && !getSound()->isBuffered(kEntityVerges)) + if (getEntities()->isInSalon(kEntityPlayer) && !getSoundQueue()->isBuffered(kEntityVerges)) getSound()->playSound(kEntityVerges, "WAT5000"); break; case kActionOpenDoor: - if (getSound()->isBuffered(kEntityVerges)) - getSound()->processEntry(kEntityVerges); + if (getSoundQueue()->isBuffered(kEntityVerges)) + getSoundQueue()->processEntry(kEntityVerges); - if (getSound()->isBuffered("MUS050")) - getSound()->processEntry("MUS050"); + if (getSoundQueue()->isBuffered("MUS050")) + getSoundQueue()->processEntry("MUS050"); getObjects()->update(kObject65, kEntityPlayer, kObjectLocationNone, kCursorNormal, kCursorForward); @@ -1811,7 +1813,7 @@ IMPLEMENT_FUNCTION(41, Verges, function41) // Fallback to next case case 2: - if (getSound()->isBuffered(kEntityVerges)) { + if (getSoundQueue()->isBuffered(kEntityVerges)) { setCallback(2); setup_updateFromTime(225); } else { diff --git a/engines/lastexpress/entities/vesna.cpp b/engines/lastexpress/entities/vesna.cpp index 8e09dbf7b0..7a1f1d3195 100644 --- a/engines/lastexpress/entities/vesna.cpp +++ b/engines/lastexpress/entities/vesna.cpp @@ -22,16 +22,18 @@ #include "lastexpress/entities/vesna.h" +#include "lastexpress/fight/fight.h" + #include "lastexpress/game/action.h" #include "lastexpress/game/entities.h" -#include "lastexpress/game/fight.h" #include "lastexpress/game/logic.h" #include "lastexpress/game/object.h" #include "lastexpress/game/savepoint.h" #include "lastexpress/game/scenes.h" -#include "lastexpress/game/sound.h" #include "lastexpress/game/state.h" +#include "lastexpress/sound/sound.h" + #include "lastexpress/lastexpress.h" #include "lastexpress/helpers.h" @@ -1082,7 +1084,7 @@ IMPLEMENT_FUNCTION(30, Vesna, function30) case kActionNone: if (!params->param1) { UPDATE_PARAM_PROC(params->param3, getState()->timeTicks, 120) - getSound()->playSound(kEntityVesna, "Ves50001", SoundManager::kFlagDefault); + getSound()->playSound(kEntityVesna, "Ves50001", kFlagDefault); params->param1 = 1; UPDATE_PARAM_PROC_END } @@ -1145,7 +1147,7 @@ IMPLEMENT_FUNCTION(30, Vesna, function30) setCallback(2); setup_savegame(kSavegameTypeEvent, kEventCathVesnaTrainTopKilled); } else { - getSound()->playSound(kEntityVesna, "Ves5001", SoundManager::kFlagDefault); + getSound()->playSound(kEntityVesna, "Ves5001", kFlagDefault); params->param1 = 1; } break; diff --git a/engines/lastexpress/entities/yasmin.cpp b/engines/lastexpress/entities/yasmin.cpp index 7e8b2f7348..45e5e11568 100644 --- a/engines/lastexpress/entities/yasmin.cpp +++ b/engines/lastexpress/entities/yasmin.cpp @@ -26,9 +26,10 @@ #include "lastexpress/game/logic.h" #include "lastexpress/game/object.h" #include "lastexpress/game/savepoint.h" -#include "lastexpress/game/sound.h" #include "lastexpress/game/state.h" +#include "lastexpress/sound/sound.h" + #include "lastexpress/lastexpress.h" #include "lastexpress/helpers.h" |