mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-24 05:01:43 +00:00
PRINCE: Fix infinite loop on bad 'look' data. Fixes #11429
This commit is contained in:
parent
1002411f2e
commit
3c5569d272
@ -87,7 +87,7 @@ PrinceEngine::PrinceEngine(OSystem *syst, const PrinceGameDescription *gameDesc)
|
||||
_shanLen(0), _directionTable(nullptr), _currentMidi(0), _lightX(0), _lightY(0), _curveData(nullptr), _curvPos(0),
|
||||
_creditsData(nullptr), _creditsDataSize(0), _currentTime(0), _zoomBitmap(nullptr), _shadowBitmap(nullptr), _transTable(nullptr),
|
||||
_flcFrameSurface(nullptr), _shadScaleValue(0), _shadLineLen(0), _scaleValue(0), _dialogImage(nullptr), _mobTranslationData(nullptr),
|
||||
_mobTranslationSize(0) {
|
||||
_mobTranslationSize(0), _missingVoice(false) {
|
||||
|
||||
// Debug/console setup
|
||||
DebugMan.addDebugChannel(DebugChannel::kScript, "script", "Prince Script debug channel");
|
||||
|
@ -316,6 +316,8 @@ public:
|
||||
uint32 _mobTranslationSize;
|
||||
byte *_mobTranslationData;
|
||||
|
||||
bool _missingVoice;
|
||||
|
||||
bool loadLocation(uint16 locationNr);
|
||||
bool loadAnim(uint16 animNr, bool loop);
|
||||
bool loadVoice(uint32 textSlot, uint32 sampleSlot, const Common::String &name);
|
||||
|
@ -1405,6 +1405,11 @@ void Interpreter::O_GETCHAR() {
|
||||
debugInterpreter("O_GETCHAR %04X (%s) %02x", flagId, _flagMap.getFlagName(flagId), _flags->getFlagValue(flagId));
|
||||
_flags->setFlagValue(flagId, *_string);
|
||||
_string++;
|
||||
|
||||
if (_vm->_missingVoice) { // Sometimes data is missing the END tag, insert it here
|
||||
_flags->setFlagValue(flagId, 255);
|
||||
_vm->_missingVoice = false;
|
||||
}
|
||||
}
|
||||
|
||||
void Interpreter::O_SETDFLAG() {
|
||||
|
@ -94,6 +94,8 @@ bool PrinceEngine::loadVoice(uint32 slot, uint32 sampleSlot, const Common::Strin
|
||||
if (getFeatures() & GF_NOVOICES)
|
||||
return false;
|
||||
|
||||
_missingVoice = false;
|
||||
|
||||
debugEngine("Loading wav %s slot %d", streamName.c_str(), slot);
|
||||
|
||||
if (slot >= kMaxTexts) {
|
||||
@ -105,6 +107,9 @@ bool PrinceEngine::loadVoice(uint32 slot, uint32 sampleSlot, const Common::Strin
|
||||
Common::SeekableReadStream *sampleStream = SearchMan.createReadStreamForMember(streamName);
|
||||
if (sampleStream == nullptr) {
|
||||
warning("loadVoice: Can't open %s", streamName.c_str());
|
||||
_missingVoice = true; // Insert END tag if needed
|
||||
_textSlots[slot]._time = 1; // Set phrase time to none
|
||||
_mainHero->_talkTime = 1;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user