LASTEXPRESS: Refactor Sound class
- Move entry-related functions to separate class - Move enumeration to shared header and rename FlagType to SoundFlag
This commit is contained in:
parent
08375150ca
commit
5d020fffad
41 changed files with 565 additions and 449 deletions
|
@ -1112,7 +1112,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);
|
||||
|
|
|
@ -2063,7 +2063,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);
|
||||
|
@ -2258,7 +2258,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))
|
||||
|
@ -3841,7 +3841,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;
|
||||
}
|
||||
|
@ -3911,11 +3911,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);
|
||||
|
@ -3940,7 +3940,7 @@ IMPLEMENT_FUNCTION(80, Anna, function80)
|
|||
|
||||
getAction()->playAnimation(kEventKronosBringFirebird);
|
||||
getScenes()->loadSceneFromItem(kItemFirebird);
|
||||
getSound()->playSound(kEntityAnna, "Mus025", SoundManager::kFlagDefault);
|
||||
getSound()->playSound(kEntityAnna, "Mus025", kFlagDefault);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
|
|
@ -199,7 +199,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 +338,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:
|
||||
|
@ -2179,7 +2179,7 @@ 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:
|
||||
|
@ -2385,7 +2385,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:
|
||||
|
|
|
@ -214,7 +214,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:
|
||||
|
|
|
@ -160,7 +160,7 @@ IMPLEMENT_FUNCTION(6, Chapters, chapter1End)
|
|||
break;
|
||||
|
||||
case kActionEndSound:
|
||||
getSound()->playSound(kEntityChapters, "MUS0009", SoundManager::kFlagDefault);
|
||||
getSound()->playSound(kEntityChapters, "MUS0009", kFlagDefault);
|
||||
break;
|
||||
|
||||
case kActionKnock:
|
||||
|
@ -192,10 +192,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);
|
||||
getSound()->playSound(kEntityChapters, "MUS009", kFlagDefault);
|
||||
|
||||
getScenes()->loadSceneFromPosition(kCarLocomotive, 38);
|
||||
|
||||
|
@ -271,7 +271,7 @@ IMPLEMENT_FUNCTION(6, Chapters, chapter1End)
|
|||
getSound()->processEntry("ZFX1007B");
|
||||
|
||||
|
||||
getSound()->playSound(kEntityPlayer, "MUS008", SoundManager::kFlagDefault);
|
||||
getSound()->playSound(kEntityPlayer, "MUS008", kFlagDefault);
|
||||
getInventory()->unselectItem();
|
||||
|
||||
// FIXME add event pump ?
|
||||
|
@ -699,7 +699,7 @@ IMPLEMENT_FUNCTION(9, Chapters, chapter1Next)
|
|||
ENTITY_PARAM(0, 3) = 0;
|
||||
}
|
||||
|
||||
getSound()->playSound(kEntityPlayer, "MUS008", SoundManager::kFlagDefault);
|
||||
getSound()->playSound(kEntityPlayer, "MUS008", kFlagDefault);
|
||||
getInventory()->unselectItem();
|
||||
|
||||
while (getSound()->isBuffered("MUS008"))
|
||||
|
@ -915,11 +915,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;
|
||||
}
|
||||
|
||||
|
@ -1214,11 +1214,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;
|
||||
}
|
||||
|
||||
|
@ -1418,7 +1418,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;
|
||||
}
|
||||
|
@ -1471,7 +1471,7 @@ label_callback_4:
|
|||
ENTITY_PARAM(0, 3) = 0;
|
||||
}
|
||||
|
||||
getSound()->playSound(kEntityPlayer, "MUS008", SoundManager::kFlagDefault);
|
||||
getSound()->playSound(kEntityPlayer, "MUS008", kFlagDefault);
|
||||
getInventory()->unselectItem();
|
||||
|
||||
while (getSound()->isBuffered("MUS008"))
|
||||
|
@ -1538,7 +1538,7 @@ label_callback_4:
|
|||
if (getSound()->isBuffered(kEntityChapters))
|
||||
getSound()->removeFromQueue(kEntityChapters);
|
||||
|
||||
getSound()->playSound(kEntityTrain, "ZFX4001", SoundManager::kFlagDefault);
|
||||
getSound()->playSound(kEntityTrain, "ZFX4001", kFlagDefault);
|
||||
|
||||
getLogic()->gameOver(kSavegameTypeIndex, 0, kSceneNone, true);
|
||||
break;
|
||||
|
@ -1674,7 +1674,7 @@ IMPLEMENT_FUNCTION(22, Chapters, chapter5Handler)
|
|||
params->param2 = 1;
|
||||
|
||||
if (!getProgress().isNightTime) {
|
||||
getSound()->playSound(kEntityChapters, "ARRIVE", SoundManager::kFlag8);
|
||||
getSound()->playSound(kEntityChapters, "ARRIVE", kFlag8);
|
||||
getSound()->processEntries();
|
||||
}
|
||||
}
|
||||
|
@ -1683,7 +1683,7 @@ IMPLEMENT_FUNCTION(22, Chapters, chapter5Handler)
|
|||
params->param3 = 1;
|
||||
|
||||
if (!getEvent(kEventLocomotiveMilosDay) && !getEvent(kEventLocomotiveMilosNight)) {
|
||||
getSound()->playSound(kEntityChapters, "ARRIVE", SoundManager::kFlag8);
|
||||
getSound()->playSound(kEntityChapters, "ARRIVE", kFlag8);
|
||||
getSound()->processEntries();
|
||||
}
|
||||
}
|
||||
|
@ -1797,7 +1797,7 @@ 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()->playSound(kEntityChapters, isEnteringStation ? "ARRIVE" : "DEPART", kFlag8);
|
||||
getSound()->processEntries();
|
||||
|
||||
getObjects()->update(kObjectHandleOutsideLeft, kEntityPlayer, kObjectLocation1, kCursorNormal, isEnteringStation ? kCursorNormal : kCursorHand);
|
||||
|
|
|
@ -258,7 +258,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:
|
||||
|
|
|
@ -255,7 +255,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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1186,7 +1186,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;
|
||||
|
|
|
@ -457,7 +457,7 @@ IMPLEMENT_FUNCTION(19, Kronos, function19)
|
|||
|
||||
case 2:
|
||||
getAction()->playAnimation(kEventConcertStart);
|
||||
getSound()->setupEntry(SoundManager::kSoundType7, kEntityKronos);
|
||||
getSound()->setupEntry(kSoundType7, kEntityKronos);
|
||||
getScenes()->loadSceneFromPosition(kCarKronos, 83);
|
||||
|
||||
RESET_ENTITY_STATE(kEntityRebecca, Rebecca, setup_function39);
|
||||
|
|
|
@ -204,7 +204,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 +235,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);
|
||||
|
|
|
@ -480,7 +480,7 @@ IMPLEMENT_FUNCTION(14, Max, freeFromCage)
|
|||
getSound()->removeFromQueue(kEntityMax);
|
||||
|
||||
getAction()->playAnimation(kEventCathMaxCage);
|
||||
getSound()->setupEntry(SoundManager::kSoundType7, kEntityMax);
|
||||
getSound()->setupEntry(kSoundType7, kEntityMax);
|
||||
getScenes()->processScene();
|
||||
break;
|
||||
|
||||
|
|
|
@ -289,7 +289,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:
|
||||
|
@ -896,7 +896,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 +984,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");
|
||||
}
|
||||
|
||||
|
@ -1199,7 +1199,7 @@ IMPLEMENT_FUNCTION(22, Mertens, function22)
|
|||
getData()->location = kLocationInsideCompartment;
|
||||
getEntities()->clearSequences(kEntityMertens);
|
||||
if (!getSound()->isBuffered(kEntityMertens))
|
||||
getSound()->playSound(kEntityMertens, "MAH1172", SoundManager::kFlagInvalid, 225);
|
||||
getSound()->playSound(kEntityMertens, "MAH1172", kFlagInvalid, 225);
|
||||
|
||||
setCallback(7);
|
||||
setup_function21(kObjectCompartment4, kObject20);
|
||||
|
|
|
@ -111,7 +111,7 @@ IMPLEMENT_FUNCTION_END
|
|||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IMPLEMENT_FUNCTION_S(7, Milos, playSound16)
|
||||
Entity::playSound(savepoint, false, SoundManager::kFlagDefault);
|
||||
Entity::playSound(savepoint, false, kFlagDefault);
|
||||
IMPLEMENT_FUNCTION_END
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1728,7 +1728,7 @@ IMPLEMENT_FUNCTION(34, Milos, chapter5Handler)
|
|||
|
||||
getSound()->processEntries();
|
||||
getAction()->playAnimation(isNight() ? kEventLocomotiveMilosNight : kEventLocomotiveMilosDay);
|
||||
getSound()->setupEntry(SoundManager::kSoundType7, kEntityMilos);
|
||||
getSound()->setupEntry(kSoundType7, kEntityMilos);
|
||||
getScenes()->loadSceneFromPosition(kCarCoalTender, 1);
|
||||
break;
|
||||
|
||||
|
|
|
@ -141,15 +141,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;
|
||||
}
|
||||
|
||||
|
@ -754,7 +754,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;
|
||||
|
|
|
@ -316,7 +316,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);
|
||||
|
@ -1357,7 +1357,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);
|
||||
|
|
|
@ -49,7 +49,7 @@ Tables::Tables(LastExpressEngine *engine, EntityIndex id) : Entity(engine, id) {
|
|||
IMPLEMENT_FUNCTION(1, Tables, chapter1)
|
||||
if (savepoint.action == kActionDefault) {
|
||||
if (_id == kEntityTables2)
|
||||
getSound()->playSoundWithSubtitles("LOOP8A.SND", SoundManager::kFlagLoop, kEntityTables2);
|
||||
getSound()->playSoundWithSubtitles("LOOP8A.SND", kFlagLoop, kEntityTables2);
|
||||
|
||||
setup_draw();
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ IMPLEMENT_FUNCTION_END
|
|||
IMPLEMENT_FUNCTION(2, Tables, chapter2)
|
||||
if (savepoint.action == kActionDefault) {
|
||||
if (_id == kEntityTables2)
|
||||
getSound()->playSoundWithSubtitles("LOOP8A.SND", SoundManager::kFlagLoop, kEntityTables2);
|
||||
getSound()->playSoundWithSubtitles("LOOP8A.SND", kFlagLoop, kEntityTables2);
|
||||
|
||||
setup_draw();
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ IMPLEMENT_FUNCTION_END
|
|||
IMPLEMENT_FUNCTION(3, Tables, chapter3)
|
||||
if (savepoint.action == kActionDefault) {
|
||||
if (_id == kEntityTables2)
|
||||
getSound()->playSoundWithSubtitles("LOOP8A.SND", SoundManager::kFlagLoop, kEntityTables2);
|
||||
getSound()->playSoundWithSubtitles("LOOP8A.SND", kFlagLoop, kEntityTables2);
|
||||
|
||||
setup_draw();
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ IMPLEMENT_FUNCTION_END
|
|||
IMPLEMENT_FUNCTION(4, Tables, chapter4)
|
||||
if (savepoint.action == kActionDefault) {
|
||||
if (_id == kEntityTables2)
|
||||
getSound()->playSoundWithSubtitles("LOOP8A.SND", SoundManager::kFlagLoop, kEntityTables2);
|
||||
getSound()->playSoundWithSubtitles("LOOP8A.SND", kFlagLoop, kEntityTables2);
|
||||
|
||||
setup_draw();
|
||||
}
|
||||
|
|
|
@ -1952,7 +1952,7 @@ IMPLEMENT_FUNCTION(48, Tatiana, function48)
|
|||
|
||||
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:
|
||||
|
|
|
@ -118,7 +118,7 @@ IMPLEMENT_FUNCTION_II(7, Train, harem, ObjectIndex, uint32)
|
|||
getObjects()->update((ObjectIndex)params->param1, kEntityTrain, kObjectLocation3, kCursorNormal, kCursorNormal);
|
||||
|
||||
// Knock / closed door sound
|
||||
getSound()->playSound(kEntityTables5, (params->param2 == 8) ? "LIB012" : "LIB013", SoundManager::kFlagDefault);
|
||||
getSound()->playSound(kEntityTables5, (params->param2 == 8) ? "LIB012" : "LIB013", kFlagDefault);
|
||||
|
||||
if (params->param4 && params->param5) {
|
||||
|
||||
|
@ -130,17 +130,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 +164,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 +191,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 +207,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 +221,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 +241,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;
|
||||
}
|
||||
|
||||
|
|
|
@ -268,7 +268,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
|
||||
|
@ -300,7 +300,7 @@ IMPLEMENT_FUNCTION(9, Vassili, function9)
|
|||
setup_seizure();
|
||||
} else {
|
||||
if (savepoint.action == kActionDefault)
|
||||
getSound()->playSound(kEntityVassili, "VAS1028", SoundManager::kFlagDefault);
|
||||
getSound()->playSound(kEntityVassili, "VAS1028", kFlagDefault);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ IMPLEMENT_FUNCTION_END
|
|||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
IMPLEMENT_FUNCTION_NOSETUP(5, Verges, playSound16)
|
||||
Entity::playSound(savepoint, false, SoundManager::kFlagDefault);
|
||||
Entity::playSound(savepoint, false, kFlagDefault);
|
||||
IMPLEMENT_FUNCTION_END
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
@ -699,7 +699,7 @@ IMPLEMENT_FUNCTION(24, Verges, policeGettingOffTrain)
|
|||
break;
|
||||
|
||||
case kActionDefault:
|
||||
getSound()->playSound(kEntityVerges, "POL1101", SoundManager::kFlagDefault);
|
||||
getSound()->playSound(kEntityVerges, "POL1101", kFlagDefault);
|
||||
break;
|
||||
|
||||
case kActionCallback:
|
||||
|
|
|
@ -1083,7 +1083,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
|
||||
}
|
||||
|
@ -1146,7 +1146,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;
|
||||
|
|
|
@ -124,7 +124,7 @@ FighterOpponentAnna::FighterOpponentAnna(LastExpressEngine *engine) : Opponent(e
|
|||
_sequences.push_back(loadSequence("2002okml.seq"));
|
||||
_sequences.push_back(loadSequence("2002okm.seq"));
|
||||
|
||||
getSound()->playSound(kEntityTables0, "MUS030", SoundManager::kFlagDefault);
|
||||
getSound()->playSound(kEntityTables0, "MUS030", kFlagDefault);
|
||||
|
||||
_field_38 = 30;
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ FighterOpponentIvo::FighterOpponentIvo(LastExpressEngine *engine) : Opponent(eng
|
|||
_sequences.push_back(loadSequence("csdr.seq"));
|
||||
_sequences.push_back(loadSequence("2003l.seq"));
|
||||
|
||||
getSound()->playSound(kEntityTables0, "MUS032", SoundManager::kFlagDefault);
|
||||
getSound()->playSound(kEntityTables0, "MUS032", kFlagDefault);
|
||||
|
||||
_countdown = 5;
|
||||
_field_38 = 15;
|
||||
|
|
|
@ -108,7 +108,7 @@ void FighterPlayerMilos::update() {
|
|||
_opponent->setSequenceAndDraw(6, kFightSequenceType1);
|
||||
|
||||
getSound()->removeFromQueue(kEntityTables0);
|
||||
getSound()->playSound(kEntityTrain, "MUS029", SoundManager::kFlagDefault);
|
||||
getSound()->playSound(kEntityTrain, "MUS029", kFlagDefault);
|
||||
|
||||
handleAction(kFightActionWin);
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ FighterOpponentMilos::FighterOpponentMilos(LastExpressEngine *engine) : Opponent
|
|||
_sequences.push_back(loadSequence("2001dbk.seq"));
|
||||
_sequences.push_back(loadSequence("2001wbk.seq"));
|
||||
|
||||
getSound()->playSound(kEntityTables0, "MUS027", SoundManager::kFlagDefault);
|
||||
getSound()->playSound(kEntityTables0, "MUS027", kFlagDefault);
|
||||
|
||||
_field_38 = 35;
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ FighterOpponentSalko::FighterOpponentSalko(LastExpressEngine *engine) : Opponent
|
|||
_sequences.push_back(loadSequence("2004ohm.seq"));
|
||||
_sequences.push_back(loadSequence("blank.seq"));
|
||||
|
||||
getSound()->playSound(kEntityTables0, "MUS035", SoundManager::kFlagDefault);
|
||||
getSound()->playSound(kEntityTables0, "MUS035", kFlagDefault);
|
||||
|
||||
_countdown = 3;
|
||||
_field_38 = 30;
|
||||
|
|
|
@ -150,7 +150,7 @@ FighterOpponentVesna::FighterOpponentVesna(LastExpressEngine *engine) : Opponent
|
|||
_sequences.push_back(loadSequence("2005csbm.seq"));
|
||||
_sequences.push_back(loadSequence("2005oam4.seq"));
|
||||
|
||||
getSound()->playSound(kEntityTables0, "MUS038", SoundManager::kFlagDefault);
|
||||
getSound()->playSound(kEntityTables0, "MUS038", kFlagDefault);
|
||||
|
||||
_countdown = 4;
|
||||
_field_38 = 30;
|
||||
|
|
|
@ -466,7 +466,7 @@ IMPLEMENT_ACTION(playMusic)
|
|||
Common::String filename = Common::String::format("MUS%03d", hotspot.param1);
|
||||
|
||||
if (!getSound()->isBuffered(filename) && (hotspot.param1 != 50 || getProgress().chapter == kChapter5))
|
||||
getSound()->playSound(kEntityPlayer, filename, SoundManager::kFlagDefault, hotspot.param2);
|
||||
getSound()->playSound(kEntityPlayer, filename, kFlagDefault, hotspot.param2);
|
||||
|
||||
return kSceneInvalid;
|
||||
}
|
||||
|
@ -806,7 +806,7 @@ IMPLEMENT_ACTION(enterCompartment)
|
|||
getSound()->playSoundEvent(kEntityPlayer, 15, 22);
|
||||
|
||||
if (getProgress().field_78 && !getSound()->isBuffered("MUS003")) {
|
||||
getSound()->playSound(kEntityPlayer, "MUS003", SoundManager::kFlagDefault);
|
||||
getSound()->playSound(kEntityPlayer, "MUS003", kFlagDefault);
|
||||
getProgress().field_78 = 0;
|
||||
}
|
||||
|
||||
|
@ -1084,7 +1084,7 @@ IMPLEMENT_ACTION(25)
|
|||
|
||||
case 2:
|
||||
if (!getSound()->isBuffered("MUS021"))
|
||||
getSound()->playSound(kEntityPlayer, "MUS021", SoundManager::kFlagDefault);
|
||||
getSound()->playSound(kEntityPlayer, "MUS021", kFlagDefault);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
|
@ -1183,7 +1183,7 @@ IMPLEMENT_ACTION(29)
|
|||
|
||||
Common::String filename = Common::String::format("MUS%03d", hotspot.param3);
|
||||
if (!getSound()->isBuffered(filename))
|
||||
getSound()->playSound(kEntityPlayer, filename, SoundManager::kFlagDefault);
|
||||
getSound()->playSound(kEntityPlayer, filename, kFlagDefault);
|
||||
|
||||
return kSceneInvalid;
|
||||
}
|
||||
|
@ -1345,7 +1345,7 @@ IMPLEMENT_ACTION(openBed)
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
// Action 37
|
||||
IMPLEMENT_ACTION(dialog)
|
||||
getSound()->playDialog(kEntityTables4, (EntityIndex)hotspot.param1, SoundManager::kFlagDefault, 0);
|
||||
getSound()->playDialog(kEntityTables4, (EntityIndex)hotspot.param1, kFlagDefault, 0);
|
||||
|
||||
return kSceneInvalid;
|
||||
}
|
||||
|
@ -1355,7 +1355,7 @@ IMPLEMENT_ACTION(dialog)
|
|||
IMPLEMENT_ACTION(eggBox)
|
||||
getSound()->playSoundEvent(kEntityPlayer, 43);
|
||||
if (getProgress().field_7C && !getSound()->isBuffered("MUS003")) {
|
||||
getSound()->playSound(kEntityPlayer, "MUS003", SoundManager::kFlagDefault);
|
||||
getSound()->playSound(kEntityPlayer, "MUS003", kFlagDefault);
|
||||
getProgress().field_7C = 0;
|
||||
}
|
||||
|
||||
|
@ -1367,7 +1367,7 @@ IMPLEMENT_ACTION(eggBox)
|
|||
IMPLEMENT_ACTION(39)
|
||||
getSound()->playSoundEvent(kEntityPlayer, 24);
|
||||
if (getProgress().field_80 && !getSound()->isBuffered("MUS003")) {
|
||||
getSound()->playSound(kEntityPlayer, "MUS003", SoundManager::kFlagDefault);
|
||||
getSound()->playSound(kEntityPlayer, "MUS003", kFlagDefault);
|
||||
getProgress().field_80 = 0;
|
||||
}
|
||||
|
||||
|
@ -1409,7 +1409,7 @@ IMPLEMENT_ACTION(playMusicChapter)
|
|||
Common::String filename = Common::String::format("MUS%03d", id);
|
||||
|
||||
if (!getSound()->isBuffered(filename))
|
||||
getSound()->playSound(kEntityPlayer, filename, SoundManager::kFlagDefault);
|
||||
getSound()->playSound(kEntityPlayer, filename, kFlagDefault);
|
||||
}
|
||||
|
||||
return kSceneInvalid;
|
||||
|
@ -1441,7 +1441,7 @@ IMPLEMENT_ACTION(playMusicChapterSetupTrain)
|
|||
Common::String filename = Common::String::format("MUS%03d", hotspot.param1);
|
||||
|
||||
if (!getSound()->isBuffered(filename) && hotspot.param3 & id) {
|
||||
getSound()->playSound(kEntityPlayer, filename, SoundManager::kFlagDefault);
|
||||
getSound()->playSound(kEntityPlayer, filename, kFlagDefault);
|
||||
|
||||
getSavePoints()->call(kEntityPlayer, kEntityTrain, kAction203863200, filename.c_str());
|
||||
getSavePoints()->push(kEntityPlayer, kEntityTrain, kAction222746496, hotspot.param2);
|
||||
|
|
|
@ -299,7 +299,7 @@ void Entities::setupChapter(ChapterIndex chapter) {
|
|||
memset(&_compartments1, 0, sizeof(_compartments1));
|
||||
memset(&_positions, 0, sizeof(_positions));
|
||||
|
||||
getSound()->resetQueue(SoundManager::kSoundType13);
|
||||
getSound()->resetQueue(kSoundType13);
|
||||
}
|
||||
|
||||
// we skip the header when doing entity setup
|
||||
|
@ -2355,7 +2355,7 @@ bool Entities::changeCar(EntityData::EntityCallData *data, EntityIndex entity, C
|
|||
if (data->car == newCar) {
|
||||
if (isInGreenCarEntrance(kEntityPlayer)) {
|
||||
getSound()->playSoundEvent(kEntityPlayer, 14);
|
||||
getSound()->excuseMe(entity, kEntityPlayer, SoundManager::kFlagDefault);
|
||||
getSound()->excuseMe(entity, kEntityPlayer, kFlagDefault);
|
||||
getScenes()->loadSceneFromPosition(kCarGreenSleeping, 1);
|
||||
getSound()->playSound(kEntityPlayer, "CAT1127A");
|
||||
getSound()->playSoundEvent(kEntityPlayer, 15);
|
||||
|
@ -2374,7 +2374,7 @@ bool Entities::changeCar(EntityData::EntityCallData *data, EntityIndex entity, C
|
|||
if (data->car == newCar) {
|
||||
if (isInKronosCarEntrance(kEntityPlayer)) {
|
||||
getSound()->playSoundEvent(kEntityPlayer, 14);
|
||||
getSound()->excuseMe(entity, kEntityPlayer, SoundManager::kFlagDefault);
|
||||
getSound()->excuseMe(entity, kEntityPlayer, kFlagDefault);
|
||||
getScenes()->loadSceneFromPosition(kCarGreenSleeping, 62);
|
||||
getSound()->playSound(kEntityPlayer, "CAT1127A");
|
||||
getSound()->playSoundEvent(kEntityPlayer, 15);
|
||||
|
|
|
@ -156,7 +156,7 @@ void Inventory::handleMouseEvent(const Common::Event &ev) {
|
|||
_portraitHighlighted = false;
|
||||
_isOpened = false;
|
||||
|
||||
getSound()->playSoundWithSubtitles("LIB039.SND", SoundManager::kFlagMenuClock, kEntityPlayer);
|
||||
getSound()->playSoundWithSubtitles("LIB039.SND", kFlagMenuClock, kEntityPlayer);
|
||||
|
||||
getMenu()->show(true, kSavegameTypeIndex, 0);
|
||||
|
||||
|
|
|
@ -432,7 +432,7 @@ void Logic::gameOver(SavegameType type, uint32 value, SceneIndex sceneIndex, boo
|
|||
|
||||
if (showScene) {
|
||||
|
||||
getSound()->processEntry(SoundManager::kSoundType11);
|
||||
getSound()->processEntry(kSoundType11);
|
||||
|
||||
if (sceneIndex && !getFlags()->mouseRightClick) {
|
||||
getScenes()->loadScene(sceneIndex);
|
||||
|
|
|
@ -1132,7 +1132,7 @@ void SceneManager::postProcessScene() {
|
|||
}
|
||||
|
||||
if (progress)
|
||||
getSound()->excuseMe((progress == 1) ? entities[0] : entities[rnd(progress)], kEntityPlayer, SoundManager::kFlagDefault);
|
||||
getSound()->excuseMe((progress == 1) ? entities[0] : entities[rnd(progress)], kEntityPlayer, kFlagDefault);
|
||||
}
|
||||
|
||||
if (hotspot->scene)
|
||||
|
@ -1157,8 +1157,8 @@ void SceneManager::postProcessScene() {
|
|||
if (getState()->time >= kTimeCityGalanta || getProgress().field_18 == 4)
|
||||
break;
|
||||
|
||||
getSound()->processEntry(SoundManager::kSoundType7);
|
||||
getSound()->playSound(kEntityTrain, "LIB050", SoundManager::kFlagDefault);
|
||||
getSound()->processEntry(kSoundType7);
|
||||
getSound()->playSound(kEntityTrain, "LIB050", kFlagDefault);
|
||||
|
||||
switch (getProgress().chapter) {
|
||||
default:
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
#include "lastexpress/game/savepoint.h"
|
||||
#include "lastexpress/game/state.h"
|
||||
|
||||
#include "lastexpress/sound/entry.h"
|
||||
|
||||
#include "lastexpress/helpers.h"
|
||||
#include "lastexpress/graphics.h"
|
||||
#include "lastexpress/lastexpress.h"
|
||||
|
@ -96,12 +98,21 @@ static const char *const locomotiveSounds[5] = {
|
|||
"ZFX1007B"
|
||||
};
|
||||
|
||||
static const SoundManager::FlagType soundFlags[32] = {
|
||||
SoundManager::kFlagDefault, SoundManager::kFlag15, SoundManager::kFlag14, SoundManager::kFlag13, SoundManager::kFlag12,
|
||||
SoundManager::kFlag11, SoundManager::kFlag11, SoundManager::kFlag10, SoundManager::kFlag10, SoundManager::kFlag9, SoundManager::kFlag9, SoundManager::kFlag8, SoundManager::kFlag8,
|
||||
SoundManager::kFlag7, SoundManager::kFlag7, SoundManager::kFlag7, SoundManager::kFlag6, SoundManager::kFlag6, SoundManager::kFlag6,
|
||||
SoundManager::kFlag5, SoundManager::kFlag5, SoundManager::kFlag5, SoundManager::kFlag5, SoundManager::kFlag4, SoundManager::kFlag4, SoundManager::kFlag4, SoundManager::kFlag4,
|
||||
SoundManager::kFlag3, SoundManager::kFlag3, SoundManager::kFlag3, SoundManager::kFlag3, SoundManager::kFlag3
|
||||
static const SoundFlag soundFlags[32] = {
|
||||
kFlagDefault,
|
||||
kFlag15,
|
||||
kFlag14,
|
||||
kFlag13,
|
||||
kFlag12,
|
||||
kFlag11, kFlag11,
|
||||
kFlag10, kFlag10,
|
||||
kFlag9, kFlag9,
|
||||
kFlag8, kFlag8,
|
||||
kFlag7, kFlag7, kFlag7,
|
||||
kFlag6, kFlag6, kFlag6,
|
||||
kFlag5, kFlag5, kFlag5, kFlag5,
|
||||
kFlag4, kFlag4, kFlag4, kFlag4,
|
||||
kFlag3, kFlag3, kFlag3, kFlag3, kFlag3
|
||||
};
|
||||
|
||||
SoundManager::SoundManager(LastExpressEngine *engine) : _engine(engine), _state(0), _currentType(kSoundType16), _flag(0) {
|
||||
|
@ -179,7 +190,7 @@ void SoundManager::resetQueue(SoundType type1, SoundType type2) {
|
|||
|
||||
for (Common::List<SoundEntry *>::iterator i = _soundList.begin(); i != _soundList.end(); ++i) {
|
||||
if ((*i)->type != type1 && (*i)->type != type2)
|
||||
resetEntry(*i);
|
||||
(*i)->reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -188,7 +199,7 @@ void SoundManager::removeFromQueue(EntityIndex entity) {
|
|||
|
||||
SoundEntry *entry = getEntry(entity);
|
||||
if (entry)
|
||||
resetEntry(entry);
|
||||
entry->reset();
|
||||
}
|
||||
|
||||
void SoundManager::removeFromQueue(Common::String filename) {
|
||||
|
@ -196,7 +207,7 @@ void SoundManager::removeFromQueue(Common::String filename) {
|
|||
|
||||
SoundEntry *entry = getEntry(filename);
|
||||
if (entry)
|
||||
resetEntry(entry);
|
||||
entry->reset();
|
||||
}
|
||||
|
||||
void SoundManager::clearQueue() {
|
||||
|
@ -244,13 +255,13 @@ bool SoundManager::isBuffered(Common::String filename, bool testForEntity) {
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
// Entry
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SoundManager::setupEntry(SoundEntry *entry, Common::String name, FlagType flag, int a4) {
|
||||
void SoundManager::setupEntry(SoundEntry *entry, Common::String name, SoundFlag flag, int a4) {
|
||||
if (!entry)
|
||||
error("SoundManager::setupEntry: Invalid entry!");
|
||||
|
||||
entry->field_4C = a4;
|
||||
setEntryType(entry, flag);
|
||||
setEntryStatus(entry, flag);
|
||||
entry->setStatus(flag);
|
||||
|
||||
// Add entry to sound list
|
||||
_soundList.push_back(entry);
|
||||
|
@ -260,7 +271,7 @@ void SoundManager::setupEntry(SoundEntry *entry, Common::String name, FlagType f
|
|||
loadSoundData(entry, name);
|
||||
}
|
||||
|
||||
void SoundManager::setEntryType(SoundEntry *entry, FlagType flag) {
|
||||
void SoundManager::setEntryType(SoundEntry *entry, SoundFlag flag) {
|
||||
switch (flag & kFlagType9) {
|
||||
default:
|
||||
case kFlagNone:
|
||||
|
@ -271,12 +282,12 @@ void SoundManager::setEntryType(SoundEntry *entry, FlagType flag) {
|
|||
case kFlagType1_2: {
|
||||
SoundEntry *previous2 = getEntry(kSoundType2);
|
||||
if (previous2)
|
||||
updateEntry(previous2, 0);
|
||||
previous2->update(0);
|
||||
|
||||
SoundEntry *previous = getEntry(kSoundType1);
|
||||
if (previous) {
|
||||
previous->type = kSoundType2;
|
||||
updateEntry(previous, 0);
|
||||
previous->update(0);
|
||||
}
|
||||
|
||||
entry->type = kSoundType1;
|
||||
|
@ -287,7 +298,7 @@ void SoundManager::setEntryType(SoundEntry *entry, FlagType flag) {
|
|||
SoundEntry *previous = getEntry(kSoundType3);
|
||||
if (previous) {
|
||||
previous->type = kSoundType4;
|
||||
updateEntry(previous, 0);
|
||||
previous->update(0);
|
||||
}
|
||||
|
||||
entry->type = kSoundType11;
|
||||
|
@ -332,21 +343,6 @@ void SoundManager::setEntryType(SoundEntry *entry, FlagType flag) {
|
|||
}
|
||||
}
|
||||
|
||||
void SoundManager::setEntryStatus(SoundEntry *entry, FlagType flag) const {
|
||||
SoundStatus status = (SoundStatus)flag;
|
||||
if (!((status & 0xFF) & kSoundStatusClear1))
|
||||
status = (SoundStatus)(status | kSoundStatusClear2);
|
||||
|
||||
if (((status & 0xFF00) >> 8) & kSoundStatusClear0)
|
||||
entry->status.status = (uint32)status;
|
||||
else
|
||||
entry->status.status = (status | kSoundStatusClear4);
|
||||
}
|
||||
|
||||
void SoundManager::setInCache(SoundEntry *entry) {
|
||||
entry->status.status |= kSoundStatusClear2;
|
||||
}
|
||||
|
||||
bool SoundManager::setupCache(SoundEntry *entry) {
|
||||
if (entry->soundData)
|
||||
return true;
|
||||
|
@ -370,8 +366,10 @@ bool SoundManager::setupCache(SoundEntry *entry) {
|
|||
if (entry->field_4C <= size)
|
||||
return false;
|
||||
|
||||
if (cacheEntry)
|
||||
setInCache(cacheEntry);
|
||||
if (!cacheEntry)
|
||||
error("[SoundManager::setupCache] Cannot find a valid entry");
|
||||
|
||||
cacheEntry->setInCache();
|
||||
|
||||
// TODO: Wait until the cache entry is ready to be removed
|
||||
while (!(cacheEntry->status.status1 & 1))
|
||||
|
@ -425,23 +423,6 @@ void SoundManager::loadSoundData(SoundEntry *entry, Common::String name) {
|
|||
}
|
||||
}
|
||||
|
||||
void SoundManager::resetEntry(SoundEntry *entry) const {
|
||||
entry->status.status |= kSoundStatusRemoved;
|
||||
entry->entity = kEntityPlayer;
|
||||
|
||||
if (entry->stream) {
|
||||
if (!entry->soundStream) {
|
||||
SAFE_DELETE(entry->stream);
|
||||
} else {
|
||||
entry->soundStream->stop();
|
||||
SAFE_DELETE(entry->soundStream);
|
||||
}
|
||||
|
||||
entry->stream = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SoundManager::removeEntry(SoundEntry *entry) {
|
||||
entry->status.status |= kSoundStatusRemoved;
|
||||
|
||||
|
@ -467,47 +448,12 @@ void SoundManager::removeEntry(SoundEntry *entry) {
|
|||
}
|
||||
}
|
||||
|
||||
void SoundManager::updateEntry(SoundEntry *entry, uint value) const {
|
||||
if (!(entry->status.status3 & 64)) {
|
||||
int value2 = value;
|
||||
|
||||
entry->status.status |= kSoundStatus_100000;
|
||||
|
||||
if (value) {
|
||||
if (_flag & 32) {
|
||||
entry->field_40 = value;
|
||||
value2 = value * 2 + 1;
|
||||
}
|
||||
|
||||
entry->field_3C = value2;
|
||||
} else {
|
||||
entry->field_3C = 0;
|
||||
entry->status.status |= kSoundStatus_40000000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SoundManager::updateEntryState(SoundEntry *entry) const {
|
||||
if (_flag & 32) {
|
||||
if (entry->type != kSoundType9 && entry->type != kSoundType7 && entry->type != kSoundType5) {
|
||||
uint32 status = entry->status.status & kSoundStatusClear1;
|
||||
|
||||
entry->status.status &= kSoundStatusClearAll;
|
||||
|
||||
entry->field_40 = status;
|
||||
entry->status.status |= status * 2 + 1;
|
||||
}
|
||||
}
|
||||
|
||||
entry->status.status |= kSoundStatus_20;
|
||||
}
|
||||
|
||||
void SoundManager::processEntry(EntityIndex entity) {
|
||||
Common::StackLock locker(_mutex);
|
||||
|
||||
SoundEntry *entry = getEntry(entity);
|
||||
if (entry) {
|
||||
updateEntry(entry, 0);
|
||||
entry->update(0);
|
||||
entry->entity = kEntityPlayer;
|
||||
}
|
||||
}
|
||||
|
@ -517,7 +463,7 @@ void SoundManager::processEntry(SoundType type) {
|
|||
|
||||
SoundEntry *entry = getEntry(type);
|
||||
if (entry)
|
||||
updateEntry(entry, 0);
|
||||
entry->update(0);
|
||||
}
|
||||
|
||||
void SoundManager::setupEntry(SoundType type, EntityIndex index) {
|
||||
|
@ -533,7 +479,7 @@ void SoundManager::processEntry(Common::String filename) {
|
|||
|
||||
SoundEntry *entry = getEntry(filename);
|
||||
if (entry) {
|
||||
updateEntry(entry, 0);
|
||||
entry->update(0);
|
||||
entry->entity = kEntityPlayer;
|
||||
}
|
||||
}
|
||||
|
@ -567,7 +513,7 @@ void SoundManager::unknownFunction4() {
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
// Entry search
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
SoundManager::SoundEntry *SoundManager::getEntry(EntityIndex index) {
|
||||
SoundEntry *SoundManager::getEntry(EntityIndex index) {
|
||||
for (Common::List<SoundEntry *>::iterator i = _soundList.begin(); i != _soundList.end(); ++i) {
|
||||
if ((*i)->entity == index)
|
||||
return *i;
|
||||
|
@ -576,7 +522,7 @@ SoundManager::SoundEntry *SoundManager::getEntry(EntityIndex index) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
SoundManager::SoundEntry *SoundManager::getEntry(Common::String name) {
|
||||
SoundEntry *SoundManager::getEntry(Common::String name) {
|
||||
if (!name.contains('.'))
|
||||
name += ".SND";
|
||||
|
||||
|
@ -588,7 +534,7 @@ SoundManager::SoundEntry *SoundManager::getEntry(Common::String name) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
SoundManager::SoundEntry *SoundManager::getEntry(SoundType type) {
|
||||
SoundEntry *SoundManager::getEntry(SoundType type) {
|
||||
for (Common::List<SoundEntry *>::iterator i = _soundList.begin(); i != _soundList.end(); ++i) {
|
||||
if ((*i)->type == type)
|
||||
return *i;
|
||||
|
@ -663,11 +609,11 @@ uint32 SoundManager::count() {
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
// Game-related functions
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void SoundManager::playSound(EntityIndex entity, Common::String filename, FlagType flag, byte a4) {
|
||||
void SoundManager::playSound(EntityIndex entity, Common::String filename, SoundFlag flag, byte a4) {
|
||||
if (isBuffered(entity) && entity)
|
||||
removeFromQueue(entity);
|
||||
|
||||
FlagType currentFlag = (flag == -1) ? getSoundFlag(entity) : (FlagType)(flag | 0x80000);
|
||||
SoundFlag currentFlag = (flag == -1) ? getSoundFlag(entity) : (SoundFlag)(flag | 0x80000);
|
||||
|
||||
// Add .SND at the end of the filename if needed
|
||||
if (!filename.contains('.'))
|
||||
|
@ -678,8 +624,8 @@ void SoundManager::playSound(EntityIndex entity, Common::String filename, FlagTy
|
|||
getSavePoints()->push(kEntityPlayer, entity, kActionEndSound);
|
||||
}
|
||||
|
||||
bool SoundManager::playSoundWithSubtitles(Common::String filename, FlagType flag, EntityIndex entity, byte a4) {
|
||||
SoundEntry *entry = new SoundEntry();
|
||||
bool SoundManager::playSoundWithSubtitles(Common::String filename, SoundFlag flag, EntityIndex entity, byte a4) {
|
||||
SoundEntry *entry = new SoundEntry(_engine);
|
||||
|
||||
Common::StackLock locker(_mutex);
|
||||
|
||||
|
@ -695,7 +641,7 @@ bool SoundManager::playSoundWithSubtitles(Common::String filename, FlagType flag
|
|||
filename.deleteLastChar();
|
||||
|
||||
showSubtitle(entry, filename);
|
||||
updateEntryState(entry);
|
||||
entry->updateState();
|
||||
}
|
||||
|
||||
return (entry->type != kSoundTypeNone);
|
||||
|
@ -711,7 +657,7 @@ void SoundManager::playSoundEvent(EntityIndex entity, byte action, byte a3) {
|
|||
return;
|
||||
|
||||
int _action = (int)action;
|
||||
FlagType flag = getSoundFlag(entity);
|
||||
SoundFlag flag = getSoundFlag(entity);
|
||||
|
||||
switch (action) {
|
||||
case 36: {
|
||||
|
@ -886,7 +832,7 @@ void SoundManager::playFightSound(byte action, byte a4) {
|
|||
playSound(kEntityTrain, Common::String::format("LIB%03d.SND", _action), kFlagDefault, a4);
|
||||
}
|
||||
|
||||
void SoundManager::playDialog(EntityIndex entity, EntityIndex entityDialog, FlagType flag, byte a4) {
|
||||
void SoundManager::playDialog(EntityIndex entity, EntityIndex entityDialog, SoundFlag flag, byte a4) {
|
||||
if (isBuffered(getDialogName(entityDialog)))
|
||||
removeFromQueue(getDialogName(entityDialog));
|
||||
|
||||
|
@ -894,7 +840,7 @@ void SoundManager::playDialog(EntityIndex entity, EntityIndex entityDialog, Flag
|
|||
}
|
||||
|
||||
void SoundManager::playLocomotiveSound() {
|
||||
playSound(kEntityPlayer, locomotiveSounds[rnd(5)], (FlagType)(rnd(15) + 2));
|
||||
playSound(kEntityPlayer, locomotiveSounds[rnd(5)], (SoundFlag)(rnd(15) + 2));
|
||||
}
|
||||
|
||||
const char *SoundManager::getDialogName(EntityIndex entity) const {
|
||||
|
@ -1400,7 +1346,7 @@ void SoundManager::playWarningCompartment(EntityIndex entity, ObjectIndex compar
|
|||
_lastWarning[compartment - 28] = getState()->timeTicks;
|
||||
}
|
||||
|
||||
void SoundManager::excuseMe(EntityIndex entity, EntityIndex entity2, FlagType flag) {
|
||||
void SoundManager::excuseMe(EntityIndex entity, EntityIndex entity2, SoundFlag flag) {
|
||||
if (isBuffered(entity) && entity != kEntityPlayer && entity != kEntityChapters && entity != kEntityTrain)
|
||||
return;
|
||||
|
||||
|
@ -1750,7 +1696,7 @@ const char *SoundManager::justAMinuteCath() const {
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
// Sound flags
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
SoundManager::FlagType SoundManager::getSoundFlag(EntityIndex entity) const {
|
||||
SoundFlag SoundManager::getSoundFlag(EntityIndex entity) const {
|
||||
if (entity == kEntityPlayer)
|
||||
return kFlagDefault;
|
||||
|
||||
|
@ -1758,7 +1704,7 @@ SoundManager::FlagType SoundManager::getSoundFlag(EntityIndex entity) const {
|
|||
return kFlagNone;
|
||||
|
||||
// Compute sound value
|
||||
FlagType ret = kFlag2;
|
||||
SoundFlag ret = kFlag2;
|
||||
|
||||
// Get default value if valid
|
||||
int index = ABS(getEntityData(entity)->entityPosition - getEntityData(kEntityPlayer)->entityPosition) / 230;
|
||||
|
@ -1771,7 +1717,7 @@ SoundManager::FlagType SoundManager::getSoundFlag(EntityIndex entity) const {
|
|||
&& !getEntities()->isOutsideAnnaWindow())
|
||||
return kFlagNone;
|
||||
|
||||
return (FlagType)(ret / 6);
|
||||
return (SoundFlag)(ret / 6);
|
||||
}
|
||||
|
||||
switch (getEntityData(entity)->car) {
|
||||
|
@ -1780,25 +1726,25 @@ SoundManager::FlagType SoundManager::getSoundFlag(EntityIndex entity) const {
|
|||
|
||||
case kCarKronos:
|
||||
if (getEntities()->isInKronosSalon(entity) != getEntities()->isInKronosSalon(kEntityPlayer))
|
||||
ret = (FlagType)(ret * 2);
|
||||
ret = (SoundFlag)(ret * 2);
|
||||
break;
|
||||
|
||||
case kCarGreenSleeping:
|
||||
case kCarRedSleeping:
|
||||
if (getEntities()->isInGreenCarEntrance(kEntityPlayer) && !getEntities()->isInKronosSalon(entity))
|
||||
ret = (FlagType)(ret * 2);
|
||||
ret = (SoundFlag)(ret * 2);
|
||||
|
||||
if (getEntityData(kEntityPlayer)->location
|
||||
&& (getEntityData(entity)->entityPosition != kPosition_1 || !getEntities()->isDistanceBetweenEntities(kEntityPlayer, entity, 400)))
|
||||
ret = (FlagType)(ret * 2);
|
||||
ret = (SoundFlag)(ret * 2);
|
||||
break;
|
||||
|
||||
case kCarRestaurant:
|
||||
if (getEntities()->isInSalon(entity) == getEntities()->isInSalon(kEntityPlayer)
|
||||
&& (getEntities()->isInRestaurant(entity) != getEntities()->isInRestaurant(kEntityPlayer)))
|
||||
ret = (FlagType)(ret * 2);
|
||||
ret = (SoundFlag)(ret * 2);
|
||||
else
|
||||
ret = (FlagType)(ret * 4);
|
||||
ret = (SoundFlag)(ret * 4);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1865,7 +1811,7 @@ void SoundManager::showSubtitle(SoundEntry *entry, Common::String filename) {
|
|||
}
|
||||
}
|
||||
|
||||
SoundManager::SubtitleEntry *SoundManager::loadSubtitle(Common::String filename, SoundEntry *soundEntry) {
|
||||
SubtitleEntry *SoundManager::loadSubtitle(Common::String filename, SoundEntry *soundEntry) {
|
||||
SubtitleEntry *entry = new SubtitleEntry();
|
||||
_subtitles.push_back(entry);
|
||||
|
||||
|
@ -1950,7 +1896,7 @@ void SoundManager::playLoopingSound(int param) {
|
|||
}
|
||||
|
||||
byte numLoops[8];
|
||||
static const EntityPosition positions[8] = { kPosition_8200, kPosition_7500,
|
||||
static const EntityPosition positions[8] = { kPosition_8200, kPosition_7500,
|
||||
kPosition_6470, kPosition_5790,
|
||||
kPosition_4840, kPosition_4070,
|
||||
kPosition_3050, kPosition_2740 };
|
||||
|
@ -2033,11 +1979,11 @@ void SoundManager::playLoopingSound(int param) {
|
|||
playSoundWithSubtitles(tmp, kFlagLoopedSound, kEntitySteam);
|
||||
|
||||
if (*snd)
|
||||
updateEntry(*snd, 0);
|
||||
(*snd)->update(0);
|
||||
|
||||
for (snd = _soundList.begin(); snd != _soundList.end(); ++snd) {
|
||||
if ((*snd)->type == kSoundType1) {
|
||||
updateEntry((*snd), 7);
|
||||
(*snd)->update(7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,52 +23,6 @@
|
|||
#ifndef LASTEXPRESS_SOUND_H
|
||||
#define LASTEXPRESS_SOUND_H
|
||||
|
||||
/*
|
||||
|
||||
Sound entry: 68 bytes (this is what appears in the savegames)
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - entity
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - ??
|
||||
char {16} - name 1
|
||||
char {16} - name 2
|
||||
|
||||
Sound queue entry: 120 bytes
|
||||
uint16 {2} - status
|
||||
byte {1} - ??
|
||||
byte {1} - ??
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - file data pointer
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - archive structure pointer
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - entity
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - ??
|
||||
char {16} - name 1
|
||||
char {16} - name 2
|
||||
uint32 {4} - pointer to next entry in the queue
|
||||
uint32 {4} - subtitle data pointer
|
||||
|
||||
*/
|
||||
|
||||
#include "lastexpress/data/snd.h"
|
||||
#include "lastexpress/data/subtitle.h"
|
||||
|
||||
#include "lastexpress/shared.h"
|
||||
|
||||
#include "lastexpress/helpers.h"
|
||||
|
@ -82,61 +36,11 @@ namespace LastExpress {
|
|||
|
||||
class LastExpressEngine;
|
||||
class SubtitleManager;
|
||||
class SoundEntry;
|
||||
class SubtitleEntry;
|
||||
|
||||
class SoundManager : Common::Serializable {
|
||||
public:
|
||||
enum SoundType {
|
||||
kSoundTypeNone = 0,
|
||||
kSoundType1,
|
||||
kSoundType2,
|
||||
kSoundType3,
|
||||
kSoundType4,
|
||||
kSoundType5,
|
||||
kSoundType6,
|
||||
kSoundType7,
|
||||
kSoundType8,
|
||||
kSoundType9,
|
||||
kSoundType10,
|
||||
kSoundType11,
|
||||
kSoundType12,
|
||||
kSoundType13,
|
||||
kSoundType14,
|
||||
kSoundType15,
|
||||
kSoundType16
|
||||
};
|
||||
|
||||
enum FlagType {
|
||||
kFlagInvalid = -1,
|
||||
kFlagNone = 0x0,
|
||||
kFlag2 = 0x2,
|
||||
kFlag3 = 0x3,
|
||||
kFlag4 = 0x4,
|
||||
kFlag5 = 0x5,
|
||||
kFlag6 = 0x6,
|
||||
kFlag7 = 0x7,
|
||||
kFlag8 = 0x8,
|
||||
kFlag9 = 0x9,
|
||||
kFlag10 = 0xA,
|
||||
kFlag11 = 0xB,
|
||||
kFlag12 = 0xC,
|
||||
kFlag13 = 0xD,
|
||||
kFlag14 = 0xE,
|
||||
kFlag15 = 0xF,
|
||||
kFlagDefault = 0x10,
|
||||
|
||||
kFlagType1_2 = 0x1000000,
|
||||
kFlagLoopedSound = 0x1001001,
|
||||
kFlagSteam = 0x1001007,
|
||||
kFlagType13 = 0x3000000,
|
||||
kFlagMenuClock = 0x3080010,
|
||||
kFlagType7 = 0x4000000,
|
||||
kFlagType11 = 0x5000000,
|
||||
kFlagMusic = 0x5000010,
|
||||
kFlagType3 = 0x6000000,
|
||||
kFlagLoop = 0x6001008,
|
||||
kFlagType9 = 0x7000000
|
||||
};
|
||||
|
||||
SoundManager(LastExpressEngine *engine);
|
||||
~SoundManager();
|
||||
|
||||
|
@ -171,10 +75,10 @@ public:
|
|||
void clearStatus();
|
||||
|
||||
// Sound playing
|
||||
void playSound(EntityIndex entity, Common::String filename, FlagType flag = kFlagInvalid, byte a4 = 0);
|
||||
bool playSoundWithSubtitles(Common::String filename, FlagType flag, EntityIndex entity, byte a4 = 0);
|
||||
void playSound(EntityIndex entity, Common::String filename, SoundFlag flag = kFlagInvalid, byte a4 = 0);
|
||||
bool playSoundWithSubtitles(Common::String filename, SoundFlag flag, EntityIndex entity, byte a4 = 0);
|
||||
void playSoundEvent(EntityIndex entity, byte action, byte a3 = 0);
|
||||
void playDialog(EntityIndex entity, EntityIndex entityDialog, FlagType flag, byte a4);
|
||||
void playDialog(EntityIndex entity, EntityIndex entityDialog, SoundFlag flag, byte a4);
|
||||
void playSteam(CityIndex index);
|
||||
void playFightSound(byte action, byte a4);
|
||||
void playLocomotiveSound();
|
||||
|
@ -185,14 +89,14 @@ public:
|
|||
const char *getDialogName(EntityIndex entity) const;
|
||||
|
||||
// Sound bites
|
||||
void excuseMe(EntityIndex entity, EntityIndex entity2 = kEntityPlayer, FlagType flag = kFlagNone);
|
||||
void excuseMe(EntityIndex entity, EntityIndex entity2 = kEntityPlayer, SoundFlag flag = kFlagNone);
|
||||
void excuseMeCath();
|
||||
const char *justCheckingCath() const;
|
||||
const char *wrongDoorCath() const;
|
||||
const char *justAMinuteCath() const;
|
||||
|
||||
// FLags
|
||||
SoundManager::FlagType getSoundFlag(EntityIndex index) const;
|
||||
SoundFlag getSoundFlag(EntityIndex index) const;
|
||||
|
||||
// Debug
|
||||
void stopAllSound();
|
||||
|
@ -201,129 +105,18 @@ public:
|
|||
void saveLoadWithSerializer(Common::Serializer &ser);
|
||||
uint32 count();
|
||||
|
||||
// Accessors
|
||||
uint32 getFlag() { return _flag; }
|
||||
|
||||
private:
|
||||
typedef int32 *SoundBuffer;
|
||||
|
||||
enum SoundStatus {
|
||||
kSoundStatus_20 = 0x20,
|
||||
kSoundStatus_40 = 0x40,
|
||||
kSoundStatus_180 = 0x180,
|
||||
kSoundStatusRemoved = 0x200,
|
||||
kSoundStatus_400 = 0x400,
|
||||
|
||||
kSoundStatus_8000 = 0x8000,
|
||||
kSoundStatus_20000 = 0x20000,
|
||||
kSoundStatus_100000 = 0x100000,
|
||||
kSoundStatus_40000000 = 0x40000000,
|
||||
|
||||
kSoundStatusClear0 = 0x10,
|
||||
kSoundStatusClear1 = 0x1F,
|
||||
kSoundStatusClear2 = 0x80,
|
||||
kSoundStatusClear3 = 0x200,
|
||||
kSoundStatusClear4 = 0x800,
|
||||
kSoundStatusClearAll = 0xFFFFFFE0
|
||||
};
|
||||
|
||||
enum SoundState {
|
||||
kSoundState0 = 0,
|
||||
kSoundState1 = 1,
|
||||
kSoundState2 = 2
|
||||
};
|
||||
|
||||
union SoundStatusUnion {
|
||||
uint32 status;
|
||||
byte status1;
|
||||
byte status2;
|
||||
byte status3;
|
||||
byte status4;
|
||||
|
||||
SoundStatusUnion() {
|
||||
status = 0;
|
||||
}
|
||||
};
|
||||
|
||||
struct SubtitleEntry;
|
||||
|
||||
struct SoundEntry {
|
||||
SoundStatusUnion status;
|
||||
SoundType type; // int
|
||||
//int data;
|
||||
//int endOffset;
|
||||
int currentDataPtr;
|
||||
void *soundData;
|
||||
//int currentBufferPtr;
|
||||
int blockCount;
|
||||
uint32 time;
|
||||
//int size;
|
||||
//int field_28;
|
||||
Common::SeekableReadStream *stream; // int
|
||||
//int field_30;
|
||||
int field_34;
|
||||
int field_38;
|
||||
int field_3C;
|
||||
int field_40;
|
||||
EntityIndex entity;
|
||||
int field_48;
|
||||
uint32 field_4C;
|
||||
Common::String name1; //char[16];
|
||||
Common::String name2; //char[16];
|
||||
//int next; // offset to the next structure in the list (not used)
|
||||
SubtitleEntry *subtitle;
|
||||
|
||||
// Sound stream
|
||||
StreamedSound *soundStream;
|
||||
|
||||
SoundEntry() {
|
||||
status.status = 0;
|
||||
type = kSoundTypeNone;
|
||||
|
||||
currentDataPtr = 0;
|
||||
soundData = NULL;
|
||||
|
||||
blockCount = 0;
|
||||
time = 0;
|
||||
|
||||
stream = NULL;
|
||||
|
||||
field_34 = 0;
|
||||
field_38 = 0;
|
||||
field_3C = 0;
|
||||
field_40 = 0;
|
||||
entity = kEntityPlayer;
|
||||
field_48 = 0;
|
||||
field_4C = 0;
|
||||
|
||||
subtitle = NULL;
|
||||
|
||||
soundStream = NULL;
|
||||
}
|
||||
|
||||
~SoundEntry() {
|
||||
// Entries that have been queued would have their streamed disposed automatically
|
||||
if (!soundStream)
|
||||
SAFE_DELETE(stream);
|
||||
|
||||
delete soundStream;
|
||||
}
|
||||
};
|
||||
|
||||
struct SubtitleEntry {
|
||||
Common::String filename;
|
||||
SoundStatusUnion status;
|
||||
SoundEntry *sound;
|
||||
SubtitleManager *data;
|
||||
|
||||
SubtitleEntry() {
|
||||
status.status = 0;
|
||||
sound = NULL;
|
||||
data = NULL;
|
||||
}
|
||||
|
||||
~SubtitleEntry() {
|
||||
SAFE_DELETE(data);
|
||||
}
|
||||
};
|
||||
|
||||
// Engine
|
||||
LastExpressEngine *_engine;
|
||||
|
||||
|
@ -337,6 +130,8 @@ private:
|
|||
uint32 _data0;
|
||||
uint32 _data1;
|
||||
uint32 _data2;
|
||||
|
||||
// TODO: this seems to be a synchronization flag for the sound timer
|
||||
uint32 _flag;
|
||||
|
||||
// Filters
|
||||
|
@ -358,17 +153,11 @@ private:
|
|||
SoundEntry *getEntry(Common::String name);
|
||||
SoundEntry *getEntry(SoundType type);
|
||||
|
||||
void setupEntry(SoundEntry *entry, Common::String name, FlagType flag, int a4);
|
||||
void setEntryType(SoundEntry *entry, FlagType flag);
|
||||
void setEntryStatus(SoundEntry *entry, FlagType flag) const;
|
||||
void setInCache(SoundEntry *entry);
|
||||
void setupEntry(SoundEntry *entry, Common::String name, SoundFlag flag, int a4);
|
||||
void setEntryType(SoundEntry *entry, SoundFlag flag);
|
||||
bool setupCache(SoundEntry *entry);
|
||||
void removeFromCache(SoundEntry *entry);
|
||||
void loadSoundData(SoundEntry *entry, Common::String name);
|
||||
|
||||
void updateEntry(SoundEntry *entry, uint value) const;
|
||||
void updateEntryState(SoundEntry *entry) const;
|
||||
void resetEntry(SoundEntry *entry) const;
|
||||
void removeEntry(SoundEntry *entry);
|
||||
|
||||
// Subtitles
|
||||
|
|
|
@ -314,7 +314,7 @@ void Menu::show(bool doSavegame, SavegameType type, uint32 value) {
|
|||
getFlags()->mouseRightClick = false;
|
||||
|
||||
// Play intro music
|
||||
getSound()->playSoundWithSubtitles("MUS001.SND", SoundManager::kFlagMusic, kEntityPlayer);
|
||||
getSound()->playSoundWithSubtitles("MUS001.SND", kFlagMusic, kEntityPlayer);
|
||||
|
||||
// Show The Smoking Car logo
|
||||
if (animation.load(getArchive("1931.nis")))
|
||||
|
@ -325,7 +325,7 @@ void Menu::show(bool doSavegame, SavegameType type, uint32 value) {
|
|||
} else {
|
||||
// Only show the quick intro
|
||||
if (!_hasShownStartScreen) {
|
||||
getSound()->playSoundWithSubtitles("MUS018.SND", SoundManager::kFlagMusic, kEntityPlayer);
|
||||
getSound()->playSoundWithSubtitles("MUS018.SND", kFlagMusic, kEntityPlayer);
|
||||
getScenes()->loadScene(kSceneStartScreen);
|
||||
|
||||
// Original game waits 60 frames and loops Sound::unknownFunction1 unless the right button is pressed
|
||||
|
@ -349,7 +349,7 @@ void Menu::show(bool doSavegame, SavegameType type, uint32 value) {
|
|||
|
||||
// Setup sound
|
||||
getSound()->unknownFunction4();
|
||||
getSound()->resetQueue(SoundManager::kSoundType11, SoundManager::kSoundType13);
|
||||
getSound()->resetQueue(kSoundType11, kSoundType13);
|
||||
if (getSound()->isBuffered("TIMER"))
|
||||
getSound()->removeFromQueue("TIMER");
|
||||
|
||||
|
@ -484,7 +484,7 @@ bool Menu::handleEvent(StartMenuAction action, Common::EventType type) {
|
|||
setLogicEventHandlers();
|
||||
|
||||
if (_index) {
|
||||
getSound()->processEntry(SoundManager::kSoundType11);
|
||||
getSound()->processEntry(kSoundType11);
|
||||
} else {
|
||||
if (!getFlags()->mouseRightClick) {
|
||||
getScenes()->loadScene((SceneIndex)(5 * _gameId + 3));
|
||||
|
@ -496,7 +496,7 @@ bool Menu::handleEvent(StartMenuAction action, Common::EventType type) {
|
|||
getScenes()->loadScene((SceneIndex)(5 * _gameId + 5));
|
||||
|
||||
if (!getFlags()->mouseRightClick) {
|
||||
getSound()->processEntry(SoundManager::kSoundType11);
|
||||
getSound()->processEntry(kSoundType11);
|
||||
|
||||
// Show intro
|
||||
Animation animation;
|
||||
|
@ -512,7 +512,7 @@ bool Menu::handleEvent(StartMenuAction action, Common::EventType type) {
|
|||
if (!getEvent(kEventIntro)) {
|
||||
getEvent(kEventIntro) = 1;
|
||||
|
||||
getSound()->processEntry(SoundManager::kSoundType11);
|
||||
getSound()->processEntry(kSoundType11);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1120,7 +1120,7 @@ void Menu::updateTime(uint32 time) {
|
|||
if (getSound()->isBuffered(kEntityChapters))
|
||||
getSound()->removeFromQueue(kEntityChapters);
|
||||
|
||||
getSound()->playSoundWithSubtitles((_currentTime >= _time) ? "LIB042" : "LIB041", SoundManager::kFlagMenuClock, kEntityChapters);
|
||||
getSound()->playSoundWithSubtitles((_currentTime >= _time) ? "LIB042" : "LIB041", kFlagMenuClock, kEntityChapters);
|
||||
adjustIndex(_currentTime, _time, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@ MODULE_OBJS := \
|
|||
menu/clock.o \
|
||||
menu/menu.o \
|
||||
menu/trainline.o \
|
||||
sound/entry.o \
|
||||
debug.o \
|
||||
detection.o \
|
||||
graphics.o \
|
||||
|
|
|
@ -27,6 +27,62 @@
|
|||
|
||||
namespace LastExpress {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Sound
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
enum SoundType {
|
||||
kSoundTypeNone = 0,
|
||||
kSoundType1,
|
||||
kSoundType2,
|
||||
kSoundType3,
|
||||
kSoundType4,
|
||||
kSoundType5,
|
||||
kSoundType6,
|
||||
kSoundType7,
|
||||
kSoundType8,
|
||||
kSoundType9,
|
||||
kSoundType10,
|
||||
kSoundType11,
|
||||
kSoundType12,
|
||||
kSoundType13,
|
||||
kSoundType14,
|
||||
kSoundType15,
|
||||
kSoundType16
|
||||
};
|
||||
|
||||
enum SoundFlag {
|
||||
kFlagInvalid = -1,
|
||||
kFlagNone = 0x0,
|
||||
kFlag2 = 0x2,
|
||||
kFlag3 = 0x3,
|
||||
kFlag4 = 0x4,
|
||||
kFlag5 = 0x5,
|
||||
kFlag6 = 0x6,
|
||||
kFlag7 = 0x7,
|
||||
kFlag8 = 0x8,
|
||||
kFlag9 = 0x9,
|
||||
kFlag10 = 0xA,
|
||||
kFlag11 = 0xB,
|
||||
kFlag12 = 0xC,
|
||||
kFlag13 = 0xD,
|
||||
kFlag14 = 0xE,
|
||||
kFlag15 = 0xF,
|
||||
kFlagDefault = 0x10,
|
||||
|
||||
kFlagType1_2 = 0x1000000,
|
||||
kFlagLoopedSound = 0x1001001,
|
||||
kFlagSteam = 0x1001007,
|
||||
kFlagType13 = 0x3000000,
|
||||
kFlagMenuClock = 0x3080010,
|
||||
kFlagType7 = 0x4000000,
|
||||
kFlagType11 = 0x5000000,
|
||||
kFlagMusic = 0x5000010,
|
||||
kFlagType3 = 0x6000000,
|
||||
kFlagLoop = 0x6001008,
|
||||
kFlagType9 = 0x7000000
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Time values
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
|
151
engines/lastexpress/sound/entry.cpp
Normal file
151
engines/lastexpress/sound/entry.cpp
Normal file
|
@ -0,0 +1,151 @@
|
|||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lastexpress/sound/entry.h"
|
||||
|
||||
#include "lastexpress/game/sound.h"
|
||||
|
||||
#include "lastexpress/helpers.h"
|
||||
#include "lastexpress/lastexpress.h"
|
||||
|
||||
#include "common/stream.h"
|
||||
|
||||
namespace LastExpress {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// SoundEntry
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
SoundEntry::SoundEntry(LastExpressEngine *engine) : _engine(engine) {
|
||||
status.status = 0;
|
||||
type = kSoundTypeNone;
|
||||
|
||||
currentDataPtr = 0;
|
||||
soundData = NULL;
|
||||
|
||||
blockCount = 0;
|
||||
time = 0;
|
||||
|
||||
stream = NULL;
|
||||
|
||||
field_34 = 0;
|
||||
field_38 = 0;
|
||||
field_3C = 0;
|
||||
field_40 = 0;
|
||||
entity = kEntityPlayer;
|
||||
field_48 = 0;
|
||||
field_4C = 0;
|
||||
|
||||
subtitle = NULL;
|
||||
|
||||
soundStream = NULL;
|
||||
}
|
||||
|
||||
SoundEntry::~SoundEntry() {
|
||||
// Entries that have been queued would have their streamed disposed automatically
|
||||
if (!soundStream)
|
||||
SAFE_DELETE(stream);
|
||||
|
||||
delete soundStream;
|
||||
|
||||
_engine = NULL;
|
||||
}
|
||||
|
||||
void SoundEntry::setStatus(SoundFlag flag) {
|
||||
SoundStatus statusFlag = (SoundStatus)flag;
|
||||
if (!((statusFlag & 0xFF) & kSoundStatusClear1))
|
||||
statusFlag = (SoundStatus)(statusFlag | kSoundStatusClear2);
|
||||
|
||||
if (((statusFlag & 0xFF00) >> 8) & kSoundStatusClear0)
|
||||
status.status = (uint32)statusFlag;
|
||||
else
|
||||
status.status = (statusFlag | kSoundStatusClear4);
|
||||
}
|
||||
|
||||
void SoundEntry::setInCache() {
|
||||
status.status |= kSoundStatusClear2;
|
||||
}
|
||||
|
||||
void SoundEntry::update(uint val) {
|
||||
if (!(status.status3 & 64)) {
|
||||
int value2 = val;
|
||||
|
||||
status.status |= kSoundStatus_100000;
|
||||
|
||||
if (val) {
|
||||
if (getSound()->getFlag() & 32) {
|
||||
field_40 = val;
|
||||
value2 = val * 2 + 1;
|
||||
}
|
||||
|
||||
field_3C = value2;
|
||||
} else {
|
||||
field_3C = 0;
|
||||
status.status |= kSoundStatus_40000000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SoundEntry::updateState() {
|
||||
if (getSound()->getFlag() & 32) {
|
||||
if (type != kSoundType9 && type != kSoundType7 && type != kSoundType5) {
|
||||
uint32 newStatus = status.status & kSoundStatusClear1;
|
||||
|
||||
status.status &= kSoundStatusClearAll;
|
||||
|
||||
field_40 = newStatus;
|
||||
status.status |= newStatus * 2 + 1;
|
||||
}
|
||||
}
|
||||
|
||||
status.status |= kSoundStatus_20;
|
||||
}
|
||||
|
||||
void SoundEntry::reset() {
|
||||
status.status |= kSoundStatusRemoved;
|
||||
entity = kEntityPlayer;
|
||||
|
||||
if (stream) {
|
||||
if (!soundStream) {
|
||||
SAFE_DELETE(stream);
|
||||
} else {
|
||||
soundStream->stop();
|
||||
SAFE_DELETE(soundStream);
|
||||
}
|
||||
|
||||
stream = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// SubtitleEntry
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
SubtitleEntry::SubtitleEntry() {
|
||||
status.status = 0;
|
||||
sound = NULL;
|
||||
data = NULL;
|
||||
}
|
||||
|
||||
SubtitleEntry::~SubtitleEntry() {
|
||||
SAFE_DELETE(data);
|
||||
}
|
||||
|
||||
} // End of namespace LastExpress
|
173
engines/lastexpress/sound/entry.h
Normal file
173
engines/lastexpress/sound/entry.h
Normal file
|
@ -0,0 +1,173 @@
|
|||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LASTEXPRESS_SOUND_ENTRY_H
|
||||
#define LASTEXPRESS_SOUND_ENTRY_H
|
||||
|
||||
/*
|
||||
Sound entry: 68 bytes (this is what appears in the savegames)
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - entity
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - ??
|
||||
char {16} - name 1
|
||||
char {16} - name 2
|
||||
|
||||
Sound queue entry: 120 bytes
|
||||
uint16 {2} - status
|
||||
byte {1} - ??
|
||||
byte {1} - ??
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - file data pointer
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - archive structure pointer
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - entity
|
||||
uint32 {4} - ??
|
||||
uint32 {4} - ??
|
||||
char {16} - name 1
|
||||
char {16} - name 2
|
||||
uint32 {4} - pointer to next entry in the queue
|
||||
uint32 {4} - subtitle data pointer
|
||||
*/
|
||||
|
||||
#include "lastexpress/data/snd.h"
|
||||
#include "lastexpress/data/subtitle.h"
|
||||
|
||||
#include "lastexpress/shared.h"
|
||||
|
||||
namespace LastExpress {
|
||||
|
||||
class LastExpressEngine;
|
||||
class SubtitleEntry;
|
||||
|
||||
enum SoundStatus {
|
||||
kSoundStatus_20 = 0x20,
|
||||
kSoundStatus_40 = 0x40,
|
||||
kSoundStatus_180 = 0x180,
|
||||
kSoundStatusRemoved = 0x200,
|
||||
kSoundStatus_400 = 0x400,
|
||||
|
||||
kSoundStatus_8000 = 0x8000,
|
||||
kSoundStatus_20000 = 0x20000,
|
||||
kSoundStatus_100000 = 0x100000,
|
||||
kSoundStatus_40000000 = 0x40000000,
|
||||
|
||||
kSoundStatusClear0 = 0x10,
|
||||
kSoundStatusClear1 = 0x1F,
|
||||
kSoundStatusClear2 = 0x80,
|
||||
kSoundStatusClear3 = 0x200,
|
||||
kSoundStatusClear4 = 0x800,
|
||||
kSoundStatusClearAll = 0xFFFFFFE0
|
||||
};
|
||||
|
||||
union SoundStatusUnion {
|
||||
uint32 status;
|
||||
byte status1;
|
||||
byte status2;
|
||||
byte status3;
|
||||
byte status4;
|
||||
|
||||
SoundStatusUnion() {
|
||||
status = 0;
|
||||
}
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// SoundEntry
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
class SoundEntry {
|
||||
public:
|
||||
SoundEntry(LastExpressEngine *engine);
|
||||
~SoundEntry();
|
||||
|
||||
void setStatus(SoundFlag flag);
|
||||
void setInCache();
|
||||
void update(uint val);
|
||||
void updateState();
|
||||
void reset();
|
||||
|
||||
private:
|
||||
LastExpressEngine *_engine;
|
||||
|
||||
public:
|
||||
SoundStatusUnion status;
|
||||
SoundType type; // int
|
||||
//int data;
|
||||
//int endOffset;
|
||||
int currentDataPtr;
|
||||
void *soundData;
|
||||
//int currentBufferPtr;
|
||||
int blockCount;
|
||||
uint32 time;
|
||||
//int size;
|
||||
//int field_28;
|
||||
Common::SeekableReadStream *stream; // int
|
||||
//int field_30;
|
||||
int field_34;
|
||||
int field_38;
|
||||
int field_3C;
|
||||
int field_40;
|
||||
EntityIndex entity;
|
||||
int field_48;
|
||||
uint32 field_4C;
|
||||
Common::String name1; //char[16];
|
||||
Common::String name2; //char[16];
|
||||
//int next; // offset to the next structure in the list (not used)
|
||||
SubtitleEntry *subtitle;
|
||||
|
||||
// Sound stream
|
||||
StreamedSound *soundStream;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// SubtitleEntry
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
class SubtitleEntry {
|
||||
public:
|
||||
SubtitleEntry();
|
||||
~SubtitleEntry();
|
||||
|
||||
public:
|
||||
Common::String filename;
|
||||
SoundStatusUnion status;
|
||||
SoundEntry *sound;
|
||||
SubtitleManager *data;
|
||||
};
|
||||
|
||||
} // End of namespace LastExpress
|
||||
|
||||
#endif // LASTEXPRESS_SOUND_ENTRY_H
|
Loading…
Add table
Add a link
Reference in a new issue