PRINCE: setVoice() fix

This commit is contained in:
lukaslw 2014-07-07 00:19:15 +02:00
parent 0301b635de
commit bdd7206fe2
4 changed files with 8 additions and 7 deletions

View File

@ -643,7 +643,8 @@ void PrinceEngine::setVoice(uint16 slot, uint32 sampleSlot, uint16 flag) {
uint32 currentString = _interpreter->getCurrentString();
if (currentString >= 80000) {
sampleName = Common::String::format("%05d-%02d.WAV", currentString - 80000, flag);
uint32 nr = currentString - 80000;
sampleName = Common::String::format("%02d0%02d-%02d.WAV", nr / 100, nr % 100, flag);
} else if (currentString >= 70000) {
sampleName = Common::String::format("inv%02d-01.WAV", currentString - 70000);
} else if (currentString >= 60000) {
@ -2072,7 +2073,7 @@ void PrinceEngine::inventoryLeftMouseButton() {
textNr = 80020; // "Nothing is happening."
}
_interpreter->setCurrentString(textNr);
printAt(0, 216, _variaTxt->getString(textNr - 80000), kNormalWidth / 2, 100);
printAt(0, 216, (char *)_variaTxt->getString(textNr - 80000), kNormalWidth / 2, 100);
setVoice(0, 28, 1);
playSample(28, 0);
//exit_normally
@ -2147,7 +2148,7 @@ void PrinceEngine::inventoryLeftMouseButton() {
textNr = 80020; // "Nothing is happening."
}
_interpreter->setCurrentString(textNr);
printAt(0, 216, _variaTxt->getString(textNr - 80000), kNormalWidth / 2, 100);
printAt(0, 216, (char *)_variaTxt->getString(textNr - 80000), kNormalWidth / 2, 100);
setVoice(0, 28, 1);
playSample(28, 0);
//exit_normally

View File

@ -932,7 +932,7 @@ void Interpreter::O_SETSTRING() {
_currentString = offset;
if (offset >= 80000) {
_string = (byte *)_vm->_variaTxt->getString(offset - 80000);
_string = _vm->_variaTxt->getString(offset - 80000);
debugInterpreter("GetVaria %s", _string);
}
else if (offset < 2000) {

View File

@ -42,12 +42,12 @@ bool VariaTxt::loadFromStream(Common::SeekableReadStream &stream) {
return true;
}
char *VariaTxt::getString(uint32 stringId) {
byte *VariaTxt::getString(uint32 stringId) {
uint32 stringOffset = READ_LE_UINT32(_data + stringId * 4);
if (stringOffset > _dataSize) {
assert(false);
}
return (char *)_data + stringOffset;
return _data + stringOffset;
}
}

View File

@ -32,7 +32,7 @@ public:
bool loadFromStream(Common::SeekableReadStream &stream);
char *getString(uint32 stringId);
byte *getString(uint32 stringId);
private:
uint32 _dataSize;